mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Add OpenAPI checker
Signed-off-by: jld3103 <jld3103yt@gmail.com>
This commit is contained in:
parent
17c63ff735
commit
11fd1f0ac1
1 changed files with 26 additions and 0 deletions
26
build/openapi-checker.sh
Executable file
26
build/openapi-checker.sh
Executable file
|
|
@ -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
|
||||
Loading…
Reference in a new issue