diff --git a/scripts/check-openapi-docs.sh b/scripts/check-openapi-docs.sh index b6ef681bc..1c97e525b 100755 --- a/scripts/check-openapi-docs.sh +++ b/scripts/check-openapi-docs.sh @@ -1,16 +1,22 @@ #!/bin/bash -APIVER=v3 -OPENAPI_COPY=$(mktemp -t openapi.json.XXX) -cp docs/$APIVER/openapi.json $OPENAPI_COPY +APIVERS="v3 admin" +for APIVER in $APIVERS; do + declare OPENAPI_COPY_${APIVER}=$(mktemp -t openapi.json.XXX) + cp docs/$APIVER/openapi.json $OPENAPI_COPY_${APIVER} +done + ./scripts/generate_docs.sh -diff docs/$APIVER/openapi.json $OPENAPI_COPY -rc=$? -if [ $rc -gt 0 ]; then - echo "docs/$APIVER/openapi.json different from file generated with './scripts/generate_docs.sh'!" -else - echo "docs/$APIVER/openapi.json consistent with generated file." -fi -rm $OPENAPI_COPY +for APIVER in $APIVERS; do + diff docs/$APIVER/openapi.json $OPENAPI_COPY_${APIVER} + rc+=$? + if [ $rc -gt 0 ]; then + echo "docs/$APIVER/openapi.json different from file generated with './scripts/generate_docs.sh'!" + else + echo "docs/$APIVER/openapi.json consistent with generated file." + fi + + rm $OPENAPI_COPY_${APIVER} +done exit $rc