-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nullable properties generate incorrect OpenAPI specification #605
Comments
I know this is old but the proposed answer is invalid JSON Schema. Is this the way it was implemented? oneOf:
- 'null' # <--- invalid JSON Schema
- $ref: '#/components/schemas/ChildSchema' For OpenAPI 3.1.x, the following syntax should be oneOf:
- type: 'null' # <--THIS
- $ref: '...' which can also be written as such: (which may have been the original thought) child:
type:
- 'null'
- object
$ref: '...' Another thought I'm having as I write this relates to Nullable in the context of OAS 3.1.x. This line should never execute because JSON Schema 2020-12 doesn't recognize the |
Expected Behavior
I updated a project from micronaut 2.5.11 to 3.1.2 and the typescript SDK generator we use stoped working correctly.
The problem is related to how nullable properties are handled.
Given a class with a nullable property like this
That class would procude this in micronaut 2.5.11 :
As of micronaut 3.1.2, it will produce :
This particular structure cause generators to see this as being a ChildSchema or an object, not a nullable property.
Instead, it should produce something like this :
You can find much more details about nullable properties here.
Actual Behaviour
No response
Steps To Reproduce
No response
Environment Information
No response
Example Application
No response
Version
3.1.2
The text was updated successfully, but these errors were encountered: