2022-11-24 20:14:59 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -eux
|
2018-04-26 16:12:08 +00:00
|
|
|
|
2022-12-12 18:55:39 +00:00
|
|
|
SWAGGER_VERSION="4.15.5"
|
2018-04-26 16:12:08 +00:00
|
|
|
TARGET_PATH=${TARGET_PATH-"swagger"}
|
2022-11-24 20:14:59 +00:00
|
|
|
|
2022-12-12 18:55:39 +00:00
|
|
|
rm -rf "$TARGET_PATH"
|
|
|
|
tmpdir="$(mktemp -d)"
|
|
|
|
trap 'rm -rf "$tmpdir"' EXIT
|
2022-11-24 20:14:59 +00:00
|
|
|
|
2022-12-12 18:55:39 +00:00
|
|
|
pushd "$tmpdir"
|
|
|
|
wget "https://github.com/swagger-api/swagger-ui/archive/refs/tags/v$SWAGGER_VERSION.tar.gz" -O swagger-ui.tgz
|
|
|
|
tar -xzf swagger-ui.tgz
|
|
|
|
popd
|
|
|
|
mv "$tmpdir/"*/dist "$TARGET_PATH"
|
2022-11-24 20:14:59 +00:00
|
|
|
cp schema.yml "$TARGET_PATH"
|
2022-12-12 18:55:39 +00:00
|
|
|
|
|
|
|
sed -i "s#https://petstore.swagger.io/v2/swagger.json#schema.yml#g" "$TARGET_PATH/swagger-initializer.js"
|