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 743d078
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions scripts/check-openapi-docs.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
#!/bin/bash
#!/usr/bin/env bash

APIVERS="v3 admin"
declare -A OPENAPI_COPY
for APIVER in $APIVERS; do
OPENAPI_COPY["$APIVER"]=$(mktemp -t openapi.json.XXX)
cp docs/$APIVER/openapi.json ${OPENAPI_COPY["$APIVER"]}
done

APIVER=v3
OPENAPI_COPY=$(mktemp -t openapi.json.XXX)
cp docs/$APIVER/openapi.json $OPENAPI_COPY
./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 ${!OPENAPI_COPY[@]}; 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 743d078

Please sign in to comment.