16

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

druidoodle
  • 193
  • 1
  • 1
  • 7

4 Answers4

34

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.

Akzhan Abdulin
  • 993
  • 6
  • 8
25

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.

Helen
  • 87,344
  • 17
  • 243
  • 314
  • yes, it works as static file too. With some limitations but I don't remember 'em. – Akzhan Abdulin Nov 07 '17 at 17:40
  • Thanks - I will try this now. Does it have the full capabilities when running in this way? – druidoodle Nov 07 '17 at 17:49
  • 1
    @druidoodle Yes - autocompletion, syntax checking, UI render, try it out, etc. – Helen Nov 07 '17 at 17:59
  • @Helen - thanks for this. It works, although not in Chrome. I think there's some issue in Chrome of accessing local storage for local files, I'll research that myself. – druidoodle Nov 07 '17 at 18:08
  • @druidoodle: try running Chrome with [`--allow-file-access-from-files`](https://stackoverflow.com/q/18586921/113116). Or better yet, run a local web server (e.g. IIS if you use Windows) and run Editor from there. – Helen Nov 07 '17 at 18:16
1

With one command with npm/npx:

npx swagger-editor-binary
user3352495
  • 374
  • 3
  • 11
0
  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.

Yufeng Lan
  • 31
  • 4