swagger-api /swagger-editor
Swagger Editor
★ 9,476⑂ 2,357👁 247⑃ 3,834● 2,058▤ 393
More from this author
+0
Daily
9,476
stars
2,357
forks
247
watchers
3,834
prs
2,058
issues
393
releases
README
SwaggerEditor
Table of Contents
- Anonymized analytics
- Getting started
- Prerequisites
- Installation
- Usage
- Development
- Prerequisites
- Setting up
- npm scripts
- Build artifacts
- Package mapping
- Documentation
- Docker
- License
- Software Bill Of Materials (SBOM)
Anonymized analytics
Swagger Editor uses Scarf to collect anonymized installation analytics. These analytics help support the maintainers of this library and ONLY run during installation. To opt out, you can set the scarfSettings.enabled field to false in your project's package.json:
// package.json
{
// ...
"scarfSettings": {
"enabled": false
}
// ...
}
Alternatively, you can set the environment variable SCARF_ANALYTICS to false as part of the environment that installs your npm packages, e.g., SCARF_ANALYTICS=false npm install.
Getting started
Prerequisites
These prerequisites are required both for installing SwaggerEditor as a npm package and local development setup.
- node-gyp with Python 3.x
- GLIBC =2.29
- emscripten or docker needs to be installed, we recommend going with a docker option
Installation
Assuming prerequisites are already installed, SwaggerEditor npm package is installable and works with Node.js = 12.22.0.
You can install SwaggerEditor via npm CLI by running the following command:
sh
$ npm install swagger-editor@alpha
NOTE: when using bundler to build your project which is using swagger-editor@5 npm package,
you might run into following Node.js error: Reached heap limit Allocation failed - JavaScript heap out of memory.
It's caused by significant amount of code that needs to be bundled. This error can be resolved
by extending the Node.js max heap limit: export NODE_OPTIONS="--max_old_space_size=4096".
Usage
Use the package in your application:
index.js:
js
import React from 'react';
import ReactDOM from 'react-dom';
import SwaggerEditor from 'swagger-editor';
import 'swagger-editor/swagger-editor.css';
const url = "https://raw.githubusercontent.com/asyncapi/spec/v2.2.0/examples/streetlights-kafka.yml";
const MyApp = () = (
SwaggerEditor Integration
);
self.MonacoEnvironment = {
/
We're building into the dist/ folder. When application starts on
URL=https://example.com then SwaggerEditor will look for
apidom.worker.js on https://example.com/dist/apidom.worker.js,
editor.worker on https://example.com/dist/editor.worker.js and
asyncapi-parser.worker.js on https://example.com/dist/asyncapi-parser.worker.js.
/
baseUrl: ${document.baseURI || location.href}dist/,
}
ReactDOM.render(, document.getElementById('swagger-editor'));
webpack.config.js (webpack@5)
Install dependencies needed for webpack@5 to properly build SwaggerEditor.
sh
$ npm i stream-browserify --save-dev
$ npm i https-browserify --save-dev
$ npm i stream-http --save-dev
$ npm i util --save-dev
$ npm i buffer --save-dev
$ npm i process --save-dev
js
const path = require('path');
const webTop issues
#5435Make window with errors expandable6 comments · 2025-04-17#5697"Collapse all/Expand all" Bug3 comments · 2026-01-22#5667feat(docker): specify a PUBLIC_URL/BASE_URL env var at runtime3 comments · 2025-12-12#5845Feature request: Pluggable document transformation API for AI-assisted editing and automation2 comments · 2026-08-06#5763OpenAPI 3.2.0 - path template expressions is not matched with Parameter Object(s)2 comments · 2026-04-16#5680Allow to set customizable codegen URLs at build time2 comments · 2026-01-09#5710Setting REACT_APP_DEFINITION_URL / REACT_APP_DEFINITION_FILE at build time has no effect1 comments · 2026-02-10#5699Code samples ignore global security when multiple security schemes are defined (ApiKey + Bearer)1 comments · 2026-01-26
Latest release
v5.11.0 v5.11.0 2026-11-135.11.0 (2026-11-13) Features editor-content-type: detect JSON Schema 2020-12 (5927) (fdec4a8)