Conversation
|
Updating the samples resulted in |
|
@spacether I wonder if you can take a look at the NPE above when you've time? Thanks. |
|
UPDATE: I've pushed e1bffbc to better handle the NPE |
| # classes don't exist yet because their module has not finished | ||
| # loading | ||
| oneOf_2 = NoneSchema | ||
| oneOf_2 = AnyTypeSchema |
There was a problem hiding this comment.
@wing328
Something is not working right here. The schema is:
NullableShape:
description: The value may be a shape or the 'null' value.
The 'nullable' attribute was introduced in OAS schema >= 3.0
and has been deprecated in OAS schema >= 3.1.
For a nullable composed schema to work, one of its chosen oneOf schemas must be type null
oneOf:
- $ref: '#/components/schemas/Triangle'
- $ref: '#/components/schemas/Quadrilateral'
- type: null
discriminator:
propertyName: shapeType
nullable: true
So the 3rd oneOf schema should be NoneSchema NOT AnyTypeSchema.
AnyTypeSchema is {} or true
There was a problem hiding this comment.
Yup, could be a regression. I tried updating the parser to 2.0.30 (released several hours ago) but no luck (no change in samples).
Can you please report the issue to swagger parser directly with the details when you've time?
There was a problem hiding this comment.
Yup, it could also be our code not seeing the null type right. If it is the parser I will report it.
There was a problem hiding this comment.
I did some investigating here:
- For yaml
type: nullthe schema is defined as an type: null AnyType schema by swagger-parser - For yaml
type: "null"the schema is correctly defined as type: "null" NoneSchema by swagger-parser
So I will:
- Update the spec to make the type be the quoted null value
- Remove the discriminator from that schema because per the openapi spec, when discriminator exists, then the discriminator key MUST exist in the payload. a null payload value cannot meet that constraint.
- Remove nullable: true because it had no impact on this schema and the type: "null" in the oneOf already allows null as does having an untyped composed schema.
Update parser to 2.0.29
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.For Windows users, please run the script in Git BASH.
master(5.3.0),6.0.x