Validate swagger 3.0.0 yaml files

Installation

Ensure npm is installed. In the shell, simply run this:

npm install -g swagger-cli

Usage

To validate swagger files (in yaml format) we use swagger-cli, if the file validates then it can be published safely.

Its usage is really simple, one would simply run (assuming the file to checked is transaction-services.yml) this:

swagger-cli validate transaction-services.yml

If the file validates, its return code will be 0, otherwise it will return 1. Please do not use the stdout or stderr, that’s not the right way to check the return of a command in UNIX.