validate_online.sh 848 Bytes
Newer Older
1
2
3
4
5
6
#!/bin/bash
#
# Requires install swagger-cli: npm install -g swagger-cli
#

# Merge the swagger definition into an unified and de-referenced file (use this file will avoid reference resolution problems during the validation)
André Costa's avatar
André Costa committed
7
8
9
10
swagger-cli bundle --dereference ./spec/updated/ngsi-ld-spec-open-api.json -o ./bundle/ngsild_swagger_combined_dereferenced.json &&
# modified version to allow circular ref
# ~/work/swagger-cli/bin/swagger-cli.js bundle --dereference="ignore" ./spec/updated/ngsi-ld-spec-open-api.json -o ./bundle/ngsild_swagger_combined_dereferenced.json &&
echo '--> Sending to validator.swagger.io' &&
11
# Validate the swagger definition against the official online swagger validation service
André Costa's avatar
André Costa committed
12
curl -X POST -d @bundle/ngsild_swagger_combined_dereferenced.json -H 'Content-Type:application/json' https://validator.swagger.io/validator/debug