funquail/docs/build_swagger.sh

14 lines
436 B
Bash
Raw Normal View History

2022-11-24 21:14:59 +01:00
#!/usr/bin/env bash
set -eux
2018-04-26 18:12:08 +02:00
2022-01-28 12:33:39 +00:00
SWAGGER_VERSION="4.1.3"
2018-04-26 18:12:08 +02:00
TARGET_PATH=${TARGET_PATH-"swagger"}
2022-11-24 21:14:59 +01:00
rm -rf "$TARGET_PATH" /tmp/swagger-ui
2018-04-26 18:12:08 +02:00
git clone --branch="v$SWAGGER_VERSION" --depth=1 "https://github.com/swagger-api/swagger-ui.git" /tmp/swagger-ui
2022-11-24 21:14:59 +01:00
mv /tmp/swagger-ui/dist "$TARGET_PATH"
cp schema.yml "$TARGET_PATH"
cp -r api "$TARGET_PATH/api"
sed -i "s,https://petstore.swagger.io/v2/swagger.json,schema.yml,g" "$TARGET_PATH/index.html"