-
Notifications
You must be signed in to change notification settings - Fork 181
Open
Labels
Breaking/Non-Breaking classificationIssues related to Breaking/Non-Breaking changes classificationIssues related to Breaking/Non-Breaking changes classification
Description
Ran into a compatibility issue, which I believe is a false positive. I have one polymorphic schema, that maps to two different property names. The backwards compatibility check fails if the mappings are re-ordered.
This should not be failing, because neither discriminator names nor the mapping changed.
For example, the following 2 should be considered compatible, but are not. Assume the actual schemas are identical. Schema A is mapped to a-type and z-type which are present in both mappings, but are ordered differently.
schema:
oneOf:
- $ref: '#/components/schemas/A'
- $ref: '#/components/schemas/B'
discriminator:
propertyName: realtype
mapping:
z-type: '#/components/schemas/A'
a-type: '#/components/schemas/A'
b-type: '#/components/schemas/B'
and
schema:
oneOf:
- $ref: '#/components/schemas/A'
- $ref: '#/components/schemas/B'
discriminator:
propertyName: realtype
mapping:
a-type: '#/components/schemas/A'
z-type: '#/components/schemas/A'
b-type: '#/components/schemas/B'
I was able to reproduce this in this repo by adding a test to OneOfDiffTest with the above as an example (based on oneOf_discriminator-missing_1.yaml).
@Test
public void testOneOfDiscrimitatorDifferentOrder() {
assertOpenApiAreEquals(OPENAPI_DOC11, OPENAPI_DOC12);
}
Metadata
Metadata
Assignees
Labels
Breaking/Non-Breaking classificationIssues related to Breaking/Non-Breaking changes classificationIssues related to Breaking/Non-Breaking changes classification