[Bug] Backward compatibility check fails on reordered discriminator mappings
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
Research direction
Start with the existing OneOfDiffTest and the oneOf_discriminator-missing_1.yaml example mentioned in the issue. Add or run the reordered-mapping case, then trace the comparison entry point it exercises. Done means the two shown schemas are treated as compatible when only discriminator mapping order differs.
Written by the indexing model from the issue text.
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);
}
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 190
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenAPITools/openapi-diff
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OpenAPITools/openapi-diff#506 ·
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OpenAPITools/openapi-diff#364 ·
-
bug OpenAP 3.1.0 Support
Difficulty 3/5 1-2 days Newbie friendliness 68/100
OpenAPITools/openapi-diff#910 · 1 comment ·
-
Render capabilities
Difficulty 3/5 1-2 days Newbie friendliness 55/100
OpenAPITools/openapi-diff#893 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
OpenAPITools/openapi-diff#883 ·
All issues in OpenAPITools/openapi-diff
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
checkstyle/test-configs#263 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
1.0.0-alpha2 Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/dpdp-accelerator#272 ·