openapi-changes icon indicating copy to clipboard operation
openapi-changes copied to clipboard

AllOf compatibility detection

Open LasneF opened this issue 1 year ago • 1 comments

given 2 files one having an AllOf of properties A and B anf one having 2 fields , openAPI change should detect that there is a change but non breaking

to do this it could actually merge the required statement of the allOf , merge the properties set and compare with the other

this for basic operation at start , then might be generalized

no_allof.txt with_allof.txt

LasneF avatar Jun 25 '24 13:06 LasneF

Hi! We rely heavily on allOf in our schema, which means we tend to get a lot of breaking changes reported by this tool, when in actuality those changes aren't really breaking. For example in this output:

  │ ├─┬channel
  │ │ ├──[➖] type (11888:17)❌ 
  │ │ ├──[➖] description (11889:24)
  │ │ ├──[➕] allOf (12462:15)
  │ │ └──[➕] allOf (12464:15)

The type and description weren't actually removed, they were just moved to one of the allOf fields, yet there's a breaking change marked here. We can simplify the spec and merge all of these before running the tool, but that means we lose line numbers making it a bit harder to debug.

I'll probably look to find a workaround for this where we do the merging anyway, but it'd be awesome if this tool could handle these instructions transparently.

mstade avatar May 07 '25 16:05 mstade