[OpenAPI Normalizer] update SIMPLIFY_ONEOF_ANYOF to convert enum of null to nullable (#14898)

* reorganize openapi normalizer tests

* add the logic to simply oneof anyof rule instead

* minor fix
This commit is contained in:
William Cheng
2023-03-09 11:10:30 +08:00
committed by GitHub
parent 77dd4990a4
commit f9efb7b2fb
5 changed files with 345 additions and 189 deletions

View File

@@ -485,7 +485,7 @@ Example:
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/simplifyBooleanEnum_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer SIMPLIFY_BOOLEAN_ENUM=true
```
- `SIMPLIFY_ONEOF_ANYOF`: when set to `true`, simplify oneOf/anyOf by 1) removing null (sub-schema) and setting nullable to true instead, and 2) simplifying oneOf/anyOf with a single sub-schema to just the sub-schema itself.
- `SIMPLIFY_ONEOF_ANYOF`: when set to `true`, simplify oneOf/anyOf by 1) removing null (sub-schema) or enum of null (sub-schema) and setting nullable to true instead, and 2) simplifying oneOf/anyOf with a single sub-schema to just the sub-schema itself.
Example:
```