Heading image

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.

For books.json:

For openapi.json:

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.

Senior Engineer @ Culture Amp. Tinkerer and professional self-isolator in 2020.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store