Merged
Conversation
One of the differences between OpenAPI 3.1 and 3.0 is how nullable values are represented: In 3.0, they are maked with `nullable: true`, and ogen handles that. In 3.1, there are two ways: - json schema type arrays for primitives: ```yaml type: - "string" - "null" ``` - oneOf with a null alternative for other things (including primitives): ```yaml oneOf: - type: "string" - type: "null" ``` This commits adds special hadling for latter to unlock openapi 3.1 compatible specs to be handled by ogen. Type array support is needed for for openapi 3.1 compatability, but this is a first step that unlocks at least some 3.1 specs to be handled by ogen.
ernado
approved these changes
Sep 17, 2025
ernado
added a commit
that referenced
this pull request
Sep 18, 2025
ngalaiko
added a commit
to ngalaiko/ogen
that referenced
this pull request
Sep 19, 2025
This reverts commit 5281f36.
ngalaiko
added a commit
to ngalaiko/ogen
that referenced
this pull request
Sep 19, 2025
This is a refined version of ogen-go#1531 I have added more tests in ./gen/nullable_oneof_test.go to make sure that all cases are covered. Also implementation was changed to handle the translation on `generate()` function level instead of a lower-lever `oneOf()`.
ngalaiko
added a commit
to ngalaiko/ogen
that referenced
this pull request
Sep 19, 2025
This reverts commit 5281f36.
ngalaiko
added a commit
to ngalaiko/ogen
that referenced
this pull request
Sep 19, 2025
This is a refined version of ogen-go#1531 I have added more tests in ./gen/nullable_oneof_test.go to make sure that all cases are covered. Also implementation was changed to handle the translation on `generate()` function level instead of a lower-lever `oneOf()`.
ngalaiko
added a commit
to ngalaiko/ogen
that referenced
this pull request
Sep 19, 2025
This is a refined version of ogen-go#1531 I have added more tests in ./gen/nullable_oneof_test.go to make sure that all cases are covered. Also implementation was changed to handle the translation on `generate()` function level instead of a lower-lever `oneOf()`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One of the differences between OpenAPI 3.1 and 3.0 is how nullable
values are represented:
In 3.0, they are maked with
nullable: true, and ogen handles that.In 3.1, there are two ways:
primitives):
This commits adds special hadling for latter to unlock openapi 3.1
compatible specs to be handled by ogen.
Type array support is needed for for openapi 3.1 compatability, but this
is a first step that unlocks at least some 3.1 specs to be handled by
ogen.