forked from loafle/openapi-generator-original
fix NPE in simplifyOneOfAnyOf (#15142)
This commit is contained in:
@@ -728,7 +728,7 @@ public class OpenAPINormalizer {
|
||||
|
||||
// if only one element left, simplify to just the element (schema)
|
||||
if (schema.getAnyOf().size() == 1) {
|
||||
if (schema.getNullable()) { // retain nullable setting
|
||||
if (Boolean.TRUE.equals(schema.getNullable())) { // retain nullable setting
|
||||
((Schema) schema.getAnyOf().get(0)).setNullable(true);
|
||||
}
|
||||
return (Schema) schema.getAnyOf().get(0);
|
||||
|
||||
@@ -36,4 +36,11 @@ components:
|
||||
enum:
|
||||
- A
|
||||
- B
|
||||
SingleAnyOfTest:
|
||||
description: to test anyOf (enum string only)
|
||||
anyOf:
|
||||
- type: string
|
||||
enum:
|
||||
- A
|
||||
- B
|
||||
|
||||
|
||||
@@ -42,4 +42,10 @@ components:
|
||||
- type: integer
|
||||
- type: string
|
||||
- $ref: null
|
||||
|
||||
SingleAnyOfTest:
|
||||
description: to test anyOf (enum string only)
|
||||
anyOf:
|
||||
- type: string
|
||||
enum:
|
||||
- A
|
||||
- B
|
||||
Reference in New Issue
Block a user