-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
The normalization setting SIMPLIFY_ONEOF_ANYOF misses to simplify oneOf schemas that has one single non-null subSchema.
This seems to be due to a misconfiguration where the SubSchemas.lengh == 1 is only checked if there was at least one nullable subSchema.
Even if there are no nullable subSchemas we should still check if the schema can be simplified when there is only a single subSchema.
openapi-generator version
7,12
OpenAPI declaration file content or url
ParentWithOneOfProperty:
type: object
properties:
number:
oneOf:
- $ref: '#/components/schemas/Number'Generation Details
Steps to reproduce
Introduce an additional test case to this test that verifies that ParentWithOneOfProperty is properly simplified to:
ParentWithOneOfProperty:
type: object
properties:
number:
- $ref: '#/components/schemas/Number'The test will fail since the schema isn't simplified.
Related issues/PRs
Suggest a fix
I will create a PR for a suggested fix
Reactions are currently unavailable