Skip to content

Instantly share code, notes, and snippets.

@alirezaarzehgar
Created November 30, 2023 20:35
Show Gist options
  • Save alirezaarzehgar/fea310f7ee0134315b077200f823d8d8 to your computer and use it in GitHub Desktop.
Save alirezaarzehgar/fea310f7ee0134315b077200f823d8d8 to your computer and use it in GitHub Desktop.
Use swagger static
#!/usr/bin/env bash
SWAGGER_JSON_PATH=/tmp/docs/swagger.json
SWAGGER_VERSION=5.10.3
SWAGGER_RELEASE=https://github.com/swagger-api/swagger-ui/archive/refs/tags/v${SWAGGER_VERSION}.zip
DIRNAME=swagger-ui-${SWAGGER_VERSION}
wget --no-clobber ${SWAGGER_RELEASE} -O swag.zip
unzip swag.zip
mkdir public
mv ${DIRNAME}/dist/* public
rm -rf ${DIRNAME}
cp ${SWAGGER_JSON_PATH} public
sed -i 's/https:\/\/petstore.swagger.io\/v2\/swagger.json/.\/swagger.json/' public/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment