Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Swagger Editor

License

NotificationsYou must be signed in to change notification settings

Deep-Consulting-Solutions/esa-swagger-editor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NPM versionBuild StatusCode ClimateBuild Status

🕰️ Looking for the older version of Swagger Editor? Refer to the2.x branch.

Swagger Editor lets you editOpenAPI API definitions 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 theKnown Issues section for more details.

This repository publishes to two different NPM modules:

  • swagger-editor is a traditional npm module intended for use in single-page applications that are capable of resolving dependencies (via Webpack, Browserify, etc).
  • swagger-editor-dist is a dependency-free module that includes everything you need to serve Swagger Editor in a server-side project, or a web project that can't resolve npm module dependencies.

If you're building a single-page application, usingswagger-editor is strongly recommended, sinceswagger-editor-dist is significantly larger.

For the older version of swagger-editor, refer to the2.x branch.

Helpful scripts

Any of the scripts below can be run by typingnpm run <script name> in the project's root directory.

Developing

Script nameDescription
devSpawn a hot-reloading dev server on port 3200.
deps-checkGenerate a size and licensing report on Swagger Editors's dependencies.
lintReport ESLint style errors and warnings.
lint-errorsReport ESLint style errors, without warnings.
lint-fixAttempt to fix style errors automatically.
watchRebuild the core files in/dist when the source code changes. Useful fornpm link.

Building

Script nameDescription
buildBuild a new set of JS and CSS assets, and output them to/dist.
build:bundleBuildswagger-editor-bundle.js only (commonJS).
build:coreBuildswagger-editor.(js|css) only (commonJS).
build:standaloneBuildswagger-editor-standalone-preset.js only (commonJS).
build:stylesheetsBuildswagger-editor.css only.
build:es:bundleBuildswagger-editor-es-bundle.js only (es2015).
build:es:bundle:coreBuildswagger-editor-es-bundle-core.js only (es2015).

Testing

Script nameDescription
testRun unit tests in Node, run Cypress end-to-end tests, and run ESLint in errors-only mode.
test:unit-mochaRun Mocha-based unit tests in Node.
test:unit-jestRun Jest-based unit tests in Node.
e2eRun end-to-end browser tests with Cypress.
lintRun ESLint test
test:artifactRun list of bundle artifact tests in Jest
test:artifact:umd:bundleRun unit test that confirmsswagger-editor-bundle exports as a Function
test:artifact:es:bundleRun unit test that confirmsswagger-editor-es-bundle exports as a Function
test:artifact:es:bundle:coreRun unit test that confirmsswagger-editor-es-bundle-core exports as a Function

Running locally

Prerequisites
  • NPM >=7.x

Generally, we recommend the following guidelines fromNode.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 >=7.x.x

If you have Node.js and npm installed, you can runnpm start to spin up a static server.

Otherwise, you can openindex.html directly 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 vianpm run dev.

Browser support

Swagger Editor works in the latest versions of Chrome, Safari, Firefox, and Edge.

Known Issues

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.

Docker

Running the image from DockerHub

There is a docker image published inDockerHub.

To use this, run the following:

docker pull swaggerapi/swagger-editordocker 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 tohttp://localhost in your browser.

  • You can provide a URL pointing to an API definition (may not be available if some security policies such as CSP or CORS are enforced):
docker run -d -p 80:8080 -e URL="https://petstore3.swagger.io/api/v3/openapi.json" swaggerapi/swagger-editor
  • You can provide your ownjson oryaml definition file from your local host:
docker run -d -p 80:8080 -v $(pwd):/tmp -e SWAGGER_FILE=/tmp/swagger.json swaggerapi/swagger-editor

Note: When bothURL andSWAGGER_FILE environment variables are set,URL has priority andSWAGGER_FILE is ignored.

  • You can specify a different base url viaBASE_URL variable for accessing the application - for example if you want the application to be available athttp://localhost/swagger-editor/:
docker run -d -p 80:8080 -e BASE_URL=/swagger-editor swaggerapi/swagger-editor
  • You can specify a different port viaPORT variable for accessing the application, default is8080.
docker run -d -p 80:80 -e PORT=80 swaggerapi/swagger-editor

You can also customize the different endpoints used by the Swagger Editor with the following environment variables. For instance, this can be useful if you have your own Swagger generator server:

Environment variableDefault value
URL_SWAGGER2_GENERATORhttps://generator.swagger.io/api/swagger.json
URL_OAS3_GENERATORhttps://generator3.swagger.io/openapi.json
URL_SWAGGER2_CONVERTERhttps://converter.swagger.io/api/convert

If you want to run the Swagger Editor locally without the Codegen features (Generate Server and Generate Client) you can set the above environment variables tonull (URL_SWAGGER2_CONVERTER=null).

Building and running an image locally

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 appnpm run build# Build an imagedocker build -t swagger-editor .# Run the containerdocker run -d -p 80:8080 swagger-editor

You can then view the app by navigating tohttp://localhost in your browser.

Documentation

Security contact

Please disclose any security-related issues or vulnerabilities by emailingsecurity@swagger.io, instead of using the public issue tracker.

About

Swagger Editor

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • JavaScript94.9%
  • Less2.7%
  • HTML1.6%
  • Other0.8%

[8]ページ先頭

©2009-2025 Movatter.jp