2022-11-24 20:14:59 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eux
|
2018-04-26 16:12:08 +00:00
|
|
|
|
2022-01-28 12:33:39 +00:00
|
|
|
SWAGGER_VERSION="4.1.3"
|
2018-04-26 16:12:08 +00:00
|
|
|
TARGET_PATH=${TARGET_PATH-"swagger"}
|
2022-11-24 20:14:59 +00:00
|
|
|
|
|
|
|
rm -rf "$TARGET_PATH" /tmp/swagger-ui
|
2018-04-26 16:12:08 +00:00
|
|
|
git clone --branch="v$SWAGGER_VERSION" --depth=1 "https://github.com/swagger-api/swagger-ui.git" /tmp/swagger-ui
|
2022-11-24 20:14:59 +00: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"
|