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.35k stars 79 forks source link

Remove `example` from schema when using it as a schema for example validation #2643

Closed niclim closed 8 months ago

niclim commented 8 months ago

🍗 Description

What does this PR do? Anything folks should know?

https://github.com/opticdev/optic/issues/2631

When passing in a schema with examples (that have id) and that schema has multiple examples, AJV thinks that there are duplicate ids and throws an error. This causes our example validation ruleset to fail.

To fix this, we remove the example and examples keywords from the schemas (similar to the spectral fix linked in the issue above)

📚 References

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

👹 QA

How can other humans verify that this PR is correct?