Skip to content

Add rule RemovedRequiredProperty #27

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

guillaume-pansier
Copy link

Resolves #26

Fix typo in rule 2001 documentation
When all required properties are removed, and none added, the comparator reports an error for both Request / Response directions (should be response only)
@holm0563
Copy link

holm0563 commented Jun 6, 2025

why would removing a required property be breaking? Any UI would still work without a re-deployment

@guillaume-pansier
Copy link
Author

Hello @holm0563, my stake on this is that if your API is exposing a property marked as required, there's a chance that your client are relying on it, and assume it's present. You mention UIs, so I'll take a TS application example, you could have something like this for example:

var myResponse: APIModel = await callAPI();
// -> cannot read property of undefined
const thisMightBreak = myResponse.attributeThatIsMarkedAsRequired.someNestedAttributes
// -> change of behavior
if(myResponse.otherBooleanAttributeMarkedAsRequired) {
  // do something
}

@guillaume-pansier
Copy link
Author

Actually, we discussed that a bit in the linked issue, here's the relevant part:

In a Response,

a RemovedRequiredProperty should be always considered as a breaking change error, since the existing clients could consider as an error a missing required property
a AddedRequiredProperty is only an informative message since it should be ignored by the existing clients.

In a Request, it is more subtle:

a RemovedRequiredProperty can be an acceptable (non-breaking) change error as long as the property is still in the schema and the server will ensure a backward compatible behavior.
a AddedRequiredProperty is always a breaking change error since the existing won't provide the property.

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

Successfully merging this pull request may close these issues.

Check the change of "required" for properties in Response schema
2 participants