Skip to content

Preserve union metadata when collapsing nullable wrappers - #2566

Draft
g-logunov wants to merge 1 commit into
oapi-codegen:mainfrom
g-logunov:feature/fix-nested-nullable-unions-upstream
Draft

g-logunov wants to merge 1 commit into
oapi-codegen:mainfrom
g-logunov:feature/fix-nested-nullable-unions-upstream

Conversation

@g-logunov

Copy link
Copy Markdown

Fixes #2565.

Nested nullable unions lose their JSON methods and accessors during generation, causing JSON round trips to replace the payload with {}.

Preserve UnionElements and Discriminator when collapsing nullable wrappers in generateUnionV2 and generateUnionV3.

Regression tests cover nested anyOf/oneOf, discriminator helpers, null values, and client/server round trips under v1, v2, and v3. The new matrix cases fail before the fix and pass afterward.

Validation: make tidy, make test, make generate, and make lint passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nested nullable unions silently discard JSON payloads

1 participant