Skip to content

Latest commit

 

History

History
69 lines (48 loc) · 1.63 KB

validating_openapi_definition.md

File metadata and controls

69 lines (48 loc) · 1.63 KB

Validating OpenAPI Definition

I have found a several tools, which work on the command line for validating a OpenAPI definition.

I need to try them out and see which one works best.

Alternatively there is the SwaggerUI editor and online editor and validator. See the separate TIL on this.

swagger-spec-validator (Javascript)

npm install -g swagger-spec-validator

On file argument:

swagger-spec-validator swagger.yaml
All OpenAPI/Swagger specs are valid.

Works also for the JSON format.

swagger-spec-validator swagger.json
All OpenAPI/Swagger specs are valid.

Via pipe:

cat swagger.yaml | swagger-spec-validator
All OpenAPI/Swagger specs are valid.

openapi-spec-validator (Python)

pip install openapi-spec-validator

On file argument:

openapi-spec-validator openapi.yaml
OK

Works also for the JSON format.

openapi-spec-validator openapi.json
OK

Via pipe (do note the dash):

cat openapi.yaml | openapi-spec-validator -
OK

Resources and References