This is the next post in a short series of spikes I am doing to better understand JSON Schema and OpenAPI v3.
In the previous two posts, we looked at validating and converting JSON schema to TypeScript, then validating the OpenAPI schema itself. In this post, we are going to go one step further and test for breaking changes.
Setting up the required files
We are going to continue on with the values that we had from the previous posts which will model a book and expect
/books to have a 200 response that returns an array of books.
Running the validation
In the above script, we are adding a breaking change by removing two of the expected properties.
If we run
node index.js, our breaking change will show!
Amazing! Since we are exiting with a non-zero code, we can start pulling things like this short script into our CI tools.
Resources And Further Reading
Image credit: Laura Chouette
Originally posted on my blog.