-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix OpenAPI 3.0 output of nullable references
When a nullable field or parameter references a non-nullable schema, we generate a schema for the field which uses anyOf to permit null. Any informational properties or additional assertions defined on the field are also put on the field schema and the type property is also retained. When we were transforming this field schema for OpenAPI 3.0, we were only doing certain transformations if the type property is not present, which doesn't handle the case above. Ensure the transformation to and from OpenAPI 3.0 schemas handles these nullable references which include the type property.
- Loading branch information
Showing
5 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
31 changes: 31 additions & 0 deletions
31
...urces/io/smallrye/openapi/runtime/scanner/components.schemas.schemaproperty-nullable.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"openapi" : "3.1.0", | ||
"components" : { | ||
"schemas" : { | ||
"FieldReferrer" : { | ||
"type" : "object", | ||
"properties" : { | ||
"a" : { | ||
"anyOf" : [ { | ||
"$ref" : "#/components/schemas/FieldTarget" | ||
}, { | ||
"type" : "null" | ||
} ] | ||
}, | ||
"b" : { | ||
"description" : "b", | ||
"type" : "object", | ||
"anyOf" : [ { | ||
"$ref" : "#/components/schemas/FieldTarget" | ||
}, { | ||
"type" : "null" | ||
} ] | ||
} | ||
} | ||
}, | ||
"FieldTarget" : { | ||
"type" : "object" | ||
} | ||
} | ||
} | ||
} |