Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule 1034: AddedRequiredProperty is not raised consistently but depends on order of the paths in the spec #59

Open
kristofferpagels opened this issue Feb 4, 2025 · 0 comments

Comments

@kristofferpagels
Copy link

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

  1. /api/v1/public/productContent
  2. /api/public/form
Rule Error JsonPath
1034 The new version has new required property 'testNotNullableProperty' that was not found in the old version. #/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:

  1. /api/public/form
  2. /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. #/paths/~1api~1public~1productContent/get/responses/200/content/application~1json/schema
1034 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

@kristofferpagels 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant