Azure / openapi-diff

Command line tool to detect breaking changes between two openapi specifications
MIT License
253 stars 34 forks source link

[Bug] Comparison of additionalProperties should be fixed #314

Open allenjzhang opened 3 months ago

allenjzhang commented 3 months ago

... when comparing additionalProperties: true vs additionalProperties: {}.

additionalProperties: true allows any additional properties of any type. additionalProperties: {} is functionally equivalent to additionalProperties: true, allowing any additional properties without specific schema constraints.

Change between them should not be flagged.

mikeharder commented 3 months ago

@allenjzhang: What is the justification for treating these as equivalent? Can you link to a spec or something that these should be equivalent?

Why are we (or our code generators) switching from true to {}?

Would you say this is really a "bug", or more a "feature request"? Because true and {} are not equivalent in all contexts.

mikekistler commented 3 months ago

For additionalProperties, true and {} are equivalent. I would classify this as a bug fix though I suppose its arguable.

mikeharder commented 3 months ago

For additionalProperties, true and {} are equivalent. I would classify this as a bug fix though I suppose its arguable.

Do you have a source for this? Is this something universally true in OpenAPI, or specific to our flavor of OpenAPI?

mikekistler commented 3 months ago

https://datatracker.ietf.org/doc/html/draft-fge-json-schema-validation-00#section-5.4.4

image