You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using the openapi-comparator NuGet to test for breaking changes in our api and its doing a fine job at that. But we have seen a case we don't understand, and have spent some time investigating it.
The problem occurs if we introduce a required property on an object used in a response.
This is as expected as a new required property has been added to the response object. However if we change the order of the paths (see old2a.json and new2a.json). I.e. we change the order of the paths:
/api/public/form
/api/v1/public/productContent
Now we still get the same difference, but we also get a second one from the schema comparison
Rule
Error
JsonPath
1034
The new version has new required property 'testNotNullableProperty' that was not found in the old version.
The new version has new required property 'testNotNullableProperty' that was not found in the old version.
#/components/schemas/ContentModel
I would assume that this second rule difference is wrong as we already have it for the response object, but at least the rule differences should not depend on the order of the paths.
/Regards
Kristoffer
The text was updated successfully, but these errors were encountered:
kristofferpagels
changed the title
Rune 1034: AddedRequiredProperty is not raised consistently but depends on order of the paths in the spec
Rule 1034: AddedRequiredProperty is not raised consistently but depends on order of the paths in the spec
Feb 4, 2025
Hi,
We are using the openapi-comparator NuGet to test for breaking changes in our api and its doing a fine job at that. But we have seen a case we don't understand, and have spent some time investigating it.
The problem occurs if we introduce a required property on an object used in a response.
I have attached four json files
We get the following difference for rule 1034 when comparing the two first json documents (old2.json and new2.json) with the following paths
/api/v1/public/productContent
/api/public/form
#/paths/~1api~1public~1productContent/get/responses/200/content/application~1json/schema
This is as expected as a new required property has been added to the response object. However if we change the order of the paths (see old2a.json and new2a.json). I.e. we change the order of the paths:
/api/public/form
/api/v1/public/productContent
Now we still get the same difference, but we also get a second one from the schema comparison
#/paths/~1api~1public~1productContent/get/responses/200/content/application~1json/schema
#/components/schemas/ContentModel
I would assume that this second rule difference is wrong as we already have it for the response object, but at least the rule differences should not depend on the order of the paths.
/Regards
Kristoffer
The text was updated successfully, but these errors were encountered: