Swagger UI includes a development server that provides hot module reloading and unminified stack traces, for easier development.
Generally, we recommend the following guidelines from Node.js Releases to only use Active LTS or Maintenance LTS releases.
Current Node.js:
Current Node.js Active LTS:
Current Node.js Maintenance LTS:
git clone https://github.com/swagger-api/swagger-ui.git
cd swagger-ui
npm run dev
You can specify a local file in dev-helpers/index.html
by changing the url
parameter. This local file MUST be located in the dev-helpers
directory or a subdirectory. As a convenience and best practice, we recommend that you create a subdirectory, dev-helpers/examples
, which is already specified in .gitignore
.
replace
url: "https://petstore.swagger.io/v2/swagger.json",
with
url: "./examples/your-local-api-definition.yaml",
Files in dev-helpers
should NOT be committed to git. The exception is if you are fixing something in index.html
or oauth2-redirect.html
, or introducing a new support file.