---
title: "Discussion on \"Codegen on oneOf: Discriminated Unions and Where Clients Flatten Them\" | Hashnode"
description: "Discussion on \"Codegen on oneOf: Discriminated Unions and Where Clients Flatten Them\". Model oneOf with an explicit discriminator and tag, inspect the generated type, and accept only a tagged union; contain flattening generators at a narrowing boundary."
url: "https://hashnode.com/posts/codegen-oneof-discriminator-unions-narrowing/6ae803955e46d3a5967eaed2"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Codegen on oneOf: Discriminated Unions and Where Clients Flatten Them](https://blogs.powerduck.com/codegen-oneof-discriminator-unions-narrowing?utm_source=hashnode&utm_medium=feed)

Model oneOf with an explicit discriminator and tag, inspect the generated type, and accept only a tagged union; contain flattening generators at a narrowing boundary.

Nov 2 · 5 min read · blogs.powerduck.com  
Read the article

-   [#openapi](https://hashnode.com/tag/openapi)
-   [#codegen](https://hashnode.com/tag/codegen)
-   [#developers](https://hashnode.com/tag/developers)

## Written by

[Powerduck](https://hashnode.com/@powerduck)

@powerduck · hon

  
[View profile](https://hashnode.com/@powerduck)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
