Skip to content
This repository was archived by the owner on Nov 13, 2021. It is now read-only.

Latest commit

 

History

History
29 lines (22 loc) · 1.03 KB

validating-open-api-specs.md

File metadata and controls

29 lines (22 loc) · 1.03 KB

Validating OpenAPI Specifications

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.

Build YAML definition

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'