mirror of
https://github.com/openziti/zrok.git
synced 2025-06-20 17:58:50 +02:00
simply generator wrapper script
This commit is contained in:
parent
2f43e92bbb
commit
798f658178
@ -2,22 +2,22 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
command -v swagger >/dev/null 2>&1 || {
|
||||
command -v swagger &>/dev/null || {
|
||||
echo >&2 "command 'swagger' not installed. see: https://github.com/go-swagger/go-swagger for installation"
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v swagger-codegen 2>&1 || {
|
||||
command -v swagger-codegen &>/dev/null || {
|
||||
echo >&2 "command 'swagger-codegen' not installed. see: https://github.com/swagger-api/swagger-codegen for installation"
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v openapi-generator-cli 2>&1 || {
|
||||
command -v openapi-generator-cli &>/dev/null || {
|
||||
echo >&2 "command 'openapi-generator-cli' not installed. see: https://www.npmjs.com/package/@openapitools/openapi-generator-cli for installation"
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v realpath 2>&1 || {
|
||||
command -v realpath &>/dev/null || {
|
||||
echo >&2 "command 'realpath' not installed. see: https://www.npmjs.com/package/realpath for installation"
|
||||
exit 1
|
||||
}
|
||||
@ -26,22 +26,17 @@ scriptPath=$(realpath "$0")
|
||||
scriptDir=$(dirname "$scriptPath")
|
||||
|
||||
zrokDir=$(realpath "$scriptDir/..")
|
||||
|
||||
zrokSpec=$(realpath "$zrokDir/specs/zrok.yml")
|
||||
|
||||
# anti-oops in case user runs this script from somewhere else
|
||||
if [[ "$(realpath "$zrokDir")" != "$(realpath "$(pwd)")" ]]
|
||||
then
|
||||
echo "ERROR: must be run from zrok root" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "...clean generate zrok server/client"
|
||||
for genDir in \
|
||||
./rest_client_zrok/ \
|
||||
./rest_model_zrok/ \
|
||||
./rest_server_zrok/
|
||||
do
|
||||
if [[ -d $genDir ]]
|
||||
then
|
||||
rm -rf "$genDir"
|
||||
else
|
||||
echo "WARN: not deleting $genDir because it does not exist" >&2
|
||||
fi
|
||||
done
|
||||
rm -rf ./rest_*
|
||||
|
||||
echo "...generating zrok server"
|
||||
swagger generate server -P rest_model_zrok.Principal -f "$zrokSpec" -s rest_server_zrok -t "$zrokDir" -m "rest_model_zrok" --exclude-main
|
||||
@ -62,17 +57,8 @@ rm -rf sdk/nodejs/sdk/src/api
|
||||
openapi-generator-cli generate -i "$zrokSpec" -o sdk/nodejs/sdk/src/api -g typescript-fetch
|
||||
|
||||
echo "...generating python sdk client"
|
||||
pyMod="sdk/python/src"
|
||||
while IFS= read -r genFile
|
||||
do
|
||||
if [[ -e "$pyMod/$genFile" ]]
|
||||
then
|
||||
rm -f "$pyMod/$genFile"
|
||||
fi
|
||||
done < "$pyMod/.openapi-generator/FILES"
|
||||
# Delete the tracking file
|
||||
rm -f "$pyMod/.openapi-generator/FILES"
|
||||
# Generate and track new files
|
||||
pyMod="./sdk/python/src"
|
||||
rm -rf "$pyMod"/{zrok_api,docs,test,.gitignore,README.md,requirements.txt}
|
||||
openapi-generator-cli generate -i "$zrokSpec" -o "$pyMod" -g python \
|
||||
--package-name zrok_api --additional-properties projectName=zrok
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
zrok
|
||||
requests
|
||||
requests
|
||||
|
Loading…
x
Reference in New Issue
Block a user