🕰️ Looking for the older version of Swagger Editor? Refer to the 2.x branch.
Swagger Editor lets you edit Swagger API specifications in YAML inside your browser and to preview documentations in real time. Valid Swagger JSON descriptions can then be generated and used with the full Swagger tooling (code generation, documentation, etc).
As a brand new version, written from the ground up, there are some known issues and unimplemented features. Check out the Known Issues section for more details.
This repository publishes to two different NPM modules:
If you're building a single-page application, using
swagger-editoris strongly recommended, since
swagger-editor-distis significantly larger.
For the older version of swagger-editor, refer to the 2.x branch.
Any of the scripts below can be run by typing
npm runin the project's root directory.
dev| Spawn a hot-reloading dev server on port 3200.
deps-check| Generate a size and licensing report on Swagger Editors's dependencies.
lint| Report ESLint style errors and warnings.
lint-errors| Report ESLint style errors, without warnings.
lint-fix| Attempt to fix style errors automatically.
watch| Rebuild the core files in
/distwhen the source code changes. Useful for
build| Build a new set of JS and CSS assets, and output them to
test| Run unit tests in Node, run Cypress end-to-end tests, and run ESLint in errors-only mode.
test:unit-mocha| Run Mocha-based unit tests in Node.
test:unit-jest| Run Jest-based unit tests in Node.
e2e| Run end-to-end browser tests with Cypress.
lint| Run ESLint test
test:artifact| Run list of bundle artifact tests in Jest
test:artifact:umd:bundle| Run unit test that confirms
swagger-editor-bundleexports as a Function
test:artifact:es:bundle| Run unit test that confirms
swagger-editor-es-bundleexports as a Function
test:artifact:es:bundle:core| Run unit test that confirms
swagger-editor-es-bundle-coreexports as a Function
Generally, we recommend the following guidelines from Node.js Releases to only use Active LTS or Maintenance LTS releases.
Current Node.js: - Node.js 16.x - NPM >=7.10.x
Current Node.js Active LTS: - Node.js 14.x - NPM >=6.12.x
Current Node.js Maintenance LTS: - Node.js >=12.4 - NPM >=6.12.x
If you have Node.js and npm installed, you can run
npm startto spin up a static server.
Otherwise, you can open
index.htmldirectly from your filesystem in your browser.
If you'd like to make code changes to Swagger Editor, you can start up a Webpack hot-reloading dev server via
npm run dev.
Swagger Editor works in the latest versions of Chrome, Safari, Firefox, and Edge.
To help with the migration, here are the currently known issues with 3.X. This list will update regularly, and will not include features that were not implemented in previous versions.
There is a docker image published in DockerHub.
To use this, run the following:
docker pull swaggerapi/swagger-editor docker run -d -p 80:8080 swaggerapi/swagger-editor
This will run Swagger Editor (in detached mode) on port 80 on your machine, so you can open it by navigating to
http://localhostin your browser.
yamldefinition file on your host
docker run -d -p 80:8080 -v $(pwd):/tmp -e SWAGGER_FILE=/tmp/swagger.json swaggerapi/swagger-editor
docker run -d -p 80:8080 -e URL=/foo/swagger.json -v /bar:/usr/share/nginx/html/foo swaggerapi/swagger-editor
docker run -d -p 80:8080 -e BASE_URL=/swagger-editor swaggerapi/swagger-editor
To build and run a docker image with the code checked out on your machine, run the following from the root directory of the project:
# Install npm packages (if needed) npm install
Build the app
npm run build
Build an image
docker build -t swagger-editor .
Run the container
docker run -d -p 80:8080 swagger-editor
You can then view the app by navigating to
http://localhostin your browser.
Please disclose any security-related issues or vulnerabilities by emailing [email protected], instead of using the public issue tracker.