Setting up a local Swagger instance

You can use a local Swagger instance to review and test new REST APIs.

Use the following instructions to install a local instance of the browser-based, open source Swagger Editor to design document REST APIs created using the Swagger Specification. The editor works alongside the Swagger User Interface, which you also install locally. Pre-built Docker containers are available for both tools, so you can install them easily on any Docker-enabled server.

  1. To deploy the Swagger editor container, run the following commands:
    • docker pull swaggerapi/swagger-editor
    • docker run -d -p 5440:8080 swaggerapi/swagger-editor
  2. To view the swagger editor, navigate to http://localhost:5440/
  1. To deploy the Swagger User Interface container, run the following commands.
    • docker pull swaggerapi/swagger-ui
    • docker run -d -p 5440:8080 swaggerapi/swagger-editor
  2. To view the Swagger User Interface, navigate to http://localhost:5440/

Ensure that you whitelist the Swagger editor/UI domain by adding it in your CORS configuration. For more information about configuring CORS, see Configuring Cross-Origin Resource Sharing (CORS) headers.

For more information about using Swagger to view and validate new REST APIs, see Testing REST APIs.