opticdev / optic

OpenAPI linting, diffing and testing. Optic helps prevent breaking changes, publish accurate documentation and improve the design of your APIs.
https://useoptic.com
MIT License
1.36k stars 83 forks source link

Merge nested allof #2729

Closed niclim closed 9 months ago

niclim commented 9 months ago

🍗 Description

What does this PR do? Anything folks should know?

This PR merges nested allOf keys (e.g. allOf: [ { allOf: [...] } ])

This PR also changes how we handle invalid allOf definitions. Instead of ignoring the allOf if there's a type: string and not flattening allOf, we ignore the type: string variant and flatten the rest (assuming there is an object). I think this is likely a better user experience, especially downstream in the rest of our app (e.g. allOf is assumed to not be there, and if it's invalid we'll get things like "every key in the allOf is removed" rule errors).

TODO

📚 References

Links to relevant docs (Notion, Twist, GH issues, etc.), if applicable.

👹 QA

How can other humans verify that this PR is correct?