swagger-api /swagger-editor

Swagger Editor

★ 9,476⑂ 2,357👁 247⑃ 3,834● 2,058▤ 393
JavaScriptCreated 2014-05-02editor.swagger.io
More from this author
Download: v5.11.0v5.11.0 ↓5.11.02026-11-13
+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 web

Top issues

Latest release

v5.11.0 v5.11.0 2026-11-13
5.11.0 (2026-11-13)


 Features

 editor-content-type: detect JSON Schema 2020-12 (5927) (fdec4a8)

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON