forked from loafle/openapi-generator-original
[openapi-normalizer] Fix nullable boolean check in oneOf schema (#15276)
* fix nullable boolean check in oneof * minor fix * fix spec
This commit is contained in:
parent
b5745e6f26
commit
e51908f176
@ -691,7 +691,7 @@ public class OpenAPINormalizer {
|
||||
|
||||
// if only one element left, simplify to just the element (schema)
|
||||
if (schema.getOneOf().size() == 1) {
|
||||
if (schema.getNullable()) { // retain nullable setting
|
||||
if (Boolean.TRUE.equals(schema.getNullable())) { // retain nullable setting
|
||||
((Schema) schema.getOneOf().get(0)).setNullable(true);
|
||||
}
|
||||
return (Schema) schema.getOneOf().get(0);
|
||||
|
@ -55,9 +55,27 @@ components:
|
||||
number:
|
||||
anyOf:
|
||||
- $ref: '#/components/schemas/Number'
|
||||
ParentWithOneOfProperty:
|
||||
type: object
|
||||
properties:
|
||||
number:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/Number'
|
||||
ParentWithPluralOneOfProperty:
|
||||
type: object
|
||||
properties:
|
||||
number:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/Number'
|
||||
- $ref: '#/components/schemas/Number2'
|
||||
Number:
|
||||
enum:
|
||||
- one
|
||||
- two
|
||||
- three
|
||||
type: string
|
||||
Number2:
|
||||
enum:
|
||||
- one
|
||||
- two
|
||||
type: string
|
Loading…
x
Reference in New Issue
Block a user