aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjld3103 <jld3103yt@gmail.com>2023-08-04 15:01:51 +0200
committerjld3103 <jld3103yt@gmail.com>2023-08-11 13:31:34 +0200
commit11fd1f0ac1f257ec094bd2c705d90c6b45504628 (patch)
tree84fca0fdca03356ad006d7504955f19e190f5856
parent17c63ff7350271a116215a4678bbfd686e130c7d (diff)
downloadnextcloud-server-11fd1f0ac1f257ec094bd2c705d90c6b45504628.tar.gz
nextcloud-server-11fd1f0ac1f257ec094bd2c705d90c6b45504628.zip
Add OpenAPI checker
Signed-off-by: jld3103 <jld3103yt@gmail.com>
-rwxr-xr-xbuild/openapi-checker.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/build/openapi-checker.sh b/build/openapi-checker.sh
new file mode 100755
index 00000000000..afe55c4a269
--- /dev/null
+++ b/build/openapi-checker.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+for path in core/openapi.json apps/*/openapi.json; do
+ composer exec generate-spec "$(dirname "$path")" "$path" || exit 1
+done
+
+files="$(git diff --name-only)"
+changed=false
+for file in $files; do
+ if [[ $file == *"openapi.json" ]]; then
+ changed=true
+ break
+ fi
+done
+
+if [ $changed = true ]
+then
+ git diff
+ echo "The OpenAPI specifications are not up to date"
+ echo "Please run: bash build/openapi-checker.sh"
+ echo "And commit the result"
+ exit 1
+else
+ echo "OpenAPI specifications up to date. Carry on"
+ exit 0
+fi