The Readme on https://github.com/swagger-api/swagger-ui specifies that Swagger-UI can be run with your own file like this
docker run -p 80:8080 -e SWAGGER_JSON=/foo/swagger.json -v /bar:/foo swaggerapi/swagger-ui
which works I if I translate it to
docker build . -t swagger-ui-local && \
docker run -p 80:8080 -e SWAGGER_JSON=/foo/my-file.json -v $PWD:/foo swagger-ui-local
This, however, ignores my local changes.
I can run my local changes with
npm run dev
but I can't figure out how to get this dev server to run anything else than the Petstore example.
Can anyone help me combine the two, so I can run swagger-ui with local code changes AND my own swagger.json?
I figured it out for npm run dev
:
Place my-file.json
in the dev-helpers
folder. Then it's available from the search bar in on http://localhost:3200/
.
To load it automatically when opening the server, alter dev-helpers/index.html
by changing
url: "http://petstore.swagger.io/v2/swagger.json"
to
url: "my-file.json"