From 743d078d48a11a24c20cfbbdfa61ce23275e1480 Mon Sep 17 00:00:00 2001 From: Patrik Segedy Date: Fri, 6 Dec 2024 14:03:16 +0100 Subject: [PATCH] check all openapi specs --- scripts/check-openapi-docs.sh | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/scripts/check-openapi-docs.sh b/scripts/check-openapi-docs.sh index b6ef681bc..f5e1de38a 100755 --- a/scripts/check-openapi-docs.sh +++ b/scripts/check-openapi-docs.sh @@ -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