This project uses oasprey to validate our OpenAPI specs against the responses returned when calling the endpoints.
Currently, this project includes tests for the following specs:
- Node.js v18 or newer recommended
- npm
From the root of the openapi directory, install dependencies:
npm installnpm testCurrently, this project uses an OpenAPI spec at a remote URL. It could alternately work with a local OpenAPI specification. If you'd prefer to work with a local file, as when you are iterating to correct errors in the OpenAPI spec and don't want to re-publish between iteration:
-
Remove the
beforeAllblock from the test file -
Add the following code above the
describeblock:// Load an OpenAPI file (YAML or JSON) into this test file loadSpec('path/to/openapi.yml'); // Write your test describe('Your test description here', () => {
With this code in place, you can update the local OpenAPI spec file and re-run the tests without regenerating the public spec.