Skip to content

Commit

Permalink
check all openapi specs
Browse files Browse the repository at this point in the history
  • Loading branch information
psegedy committed Dec 6, 2024
1 parent c8e961a commit 5a01d38
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions scripts/check-openapi-docs.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5a01d38

Please sign in to comment.