Files
qdrant/tests/openapi_consistency_check.sh
Tim Visée d74bfa088c Add CI job to enforce generated OpenAPI and gRPC file consistency (#1667)
* Add test script to ensure OpenAPI files are consistent with sources

* Add CI job to test OpenAPI file consistency

* Add CI task to test gRPC file consistency

* Tweak consistency scripts a bit, touch temp file to trigger gRPC rebuild

* Don't test .gitignored files

* Mention updating the OpenAPI specification is enforced by CI

* Update CI job configuration

* Also check consistency of gRPC docs

* Rename temporary files to have a .diff prefix

* Add docs to consistency checking scripts
2023-04-10 14:38:53 +02:00

37 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Some OpenAPI files in this repository are generated and based upon other
# sources. When these sources change, the generated files must be generated
# (and committed) again. It is the task of the contributing user to do this
# properly.
#
# This tests makes sure the generated OpenAPI files are consistent with its
# sources. If this fails, you probably have to generate the OpenAPI files again.
#
# Read more here: https://github.com/qdrant/qdrant/blob/master/docs/DEVELOPMENT.md#rest
set -ex
# Ensure current path is project root
cd "$(dirname "$0")/../"
# Keep current version of file to check
cp ./docs/redoc/master/{,.diff.}openapi.json
# Regenerate OpenAPI files
tools/generate_openapi_models.sh
# Ensure generated files are the same as files in this repository
if diff -Zwa ./docs/redoc/master/{,.diff.}openapi.json
then
set +x
echo "No diffs found."
else
set +x
echo "ERROR: Generated OpenAPI files are not consistent with files in this repository, see diff above."
echo "ERROR: See: https://github.com/qdrant/qdrant/blob/master/docs/DEVELOPMENT.md#rest"
exit 1
fi
# Cleanup
rm -f ./docs/redoc/master/.diff.openapi.json