It is crucial to only ship OpenAPI specifications that are according the official specification.
In order to achieve this, the generated OpenAPI specs for your application should be automatically validated during pull requests.
This can be achieved by using swagger-cli NPM package which you can call via a CLI:
# Install the package
npm install -g swagger-cli
# Validate the OpenAPI specs located in 'deploy/openapi/specs.json'
swagger-cli validate deploy/openapi/specs.json
More features and how to use the tool can be found in the documentation.
Here is a YAML representation of the build that you can use.
pool:
name: Hosted VS2017
steps:
- powershell: 'npm install -g swagger-cli'
displayName: 'Install swagger-cli'
- powershell: 'swagger-cli validate deploy/openapi/specs.json'
displayName: 'Validate OpenAPI specs'