Swagger Editor offline installation

2020-03-03 08:34发布

问题:

Our company is using swagger to document their API's, currently a couple of developers are using the online swagger editor on their PC's.

I want to move this piece of the design process into our standard development environment, which is in a walled garden without internet access.

How do I go about installing npm and the swagger editor in an offline environment?

There are options to use either RHEL or Windows machines, although Windows is preferable as developers have local admin rights

回答1:

npm is not required, you can download the compiled files from the Swagger Editor repository:

  • index.html
  • dist\*

and open index.html locally (from the file system) or put the files onto a web server in your network.



回答2:

In short answer is https://swagger.io/docs/swagger-tools/#swagger-editor

git clone https://github.com/swagger-api/swagger-editor.git
cd swagger-editor
npm install
npm run build
npm start

And it will works in your Intranet OK.



回答3:

  1. Download the one of the source releases from swagger-editor's github page (click releases link on the page)
  2. unzip the downloaded source release zip/tar file.
  3. cd into the extracted source dir, type 'npm install' (or if you have some npm mirror module installed, such as cnpm, use 'cnpm install' instead)
  4. Use a browser to open index.html file in the source dir. Or, follow official guide the 'Setup with http-server module from GitHub' section to serve from a local static web server.

PS. You don't need to build the source code unless you want to contribute as written in the 'Contribute' section of the official document.



回答4:

With one command with npm/npx:

npx swagger-editor-binary