-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Open
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?
- 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 OpenAPINormalizer wraps oneOf and anyOf items into allOf compositions when they have discriminator labels (e.g., title field).
openapi-generator version
OpenAPI declaration file content or url
Pet:
oneOf:
- title: dog
description: "A dog pet"
$ref: '#/components/schemas/Dog'
- title: cat
description: "A cat pet"
$ref: '#/components/schemas/Cat'
- title: bird
description: "A bird pet"
$ref: '#/components/schemas/Bird'
Actual:
Pet:
oneOf:
- allOf:
- $ref: '#/components/schemas/Dog'
title: dog
description: "A dog pet"
- allOf:
- $ref: '#/components/schemas/Cat'
title: cat
description: "A cat pet"
- allOf:
- $ref: '#/components/schemas/Bird'
title: bird
description: "A bird pet"
discriminator:
propertyName: petType
expected. For oneOf/anyOf discriminator labels, we should leave them unchanged.
Pet:
oneOf:
- title: dog
description: "A dog pet"
$ref: '#/components/schemas/Dog'
- title: cat
description: "A cat pet"
$ref: '#/components/schemas/Cat'
- title: bird
description: "A bird pet"
$ref: '#/components/schemas/Bird'
discriminator:
propertyName: petType
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix
Implement context-aware normalization. skip normalization for oneOf/anyOf items, but keep normalizing regular properties.