Sorry, but the page you were trying to view does not exist.
146 |
It looks like this was the result of either:
147 |
148 |
a mistyped address
149 |
an out-of-date link
150 |
151 |
154 |
155 |
156 |
157 |
158 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | ###
2 | # swagger-editor - https://github.com/swagger-api/swagger-editor/
3 | #
4 | # Run the swagger-editor service on port 8080
5 | ###
6 |
7 | FROM mhart/alpine-node
8 |
9 | RUN npm install -g http-server
10 |
11 | WORKDIR /editor
12 | ADD ./ /editor
13 |
14 | # The default port of the application
15 | EXPOSE 8080
16 |
17 | CMD ["http-server", "--cors", "-p8080", "/editor"]
18 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Licensed under the Apache License, Version 2.0 (the "License");
2 | you may not use this file except in compliance with the License.
3 | You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
4 |
5 | Unless required by applicable law or agreed to in writing, software
6 | distributed under the License is distributed on an "AS IS" BASIS,
7 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8 | See the License for the specific language governing permissions and
9 | limitations under the License.
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # BOSH Editor
2 |
3 | This is a fork of swagger editor. It modifies it to adapt to [BOSH](https://bosh.io/) manifests.
4 |
5 | Ongoing Work. Find a sample installation here : [http://bosh.jamilshamy.me/](http://bosh.jamilshamy.me/)
6 |
--------------------------------------------------------------------------------
/config/defaults.json:
--------------------------------------------------------------------------------
1 | {
2 | "analytics": {
3 | "google": {
4 | "id": "helloooooooo"
5 | }
6 | },
7 | "examplesFolder": "spec-files/",
8 | "editorOptions": {
9 | "theme": "ace/theme/atom_dark"
10 | },
11 | "exampleFiles": [
12 | "cf-deployment.yml",
13 | "jmeter-storm-mode.yml",
14 | "jmeter-tornado-mode.yml",
15 | "concourse.yml"
16 | ],
17 | "autoCompleteMode" : "Deployment-Manifest",
18 | "autoCompleteModes": [
19 | "Deployment-Manifest",
20 | "Runtime-Config"
21 | ],
22 | "autocompleteExtension": {},
23 | "keyPressDebounceTime": 200,
24 | "disableFileMenu": false,
25 | "headerBranding": false,
26 | "disableNewUserIntro": false,
27 | "enableTryIt": true,
28 | "brandingCssClass": "",
29 | "importProxyUrl": "https://example.com/",
30 | "pointerResolutionBasePath": null
31 | }
32 |
--------------------------------------------------------------------------------
/config/defaults.json.guide.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | /** *****************************************************************************
4 | * This is a guide for defaults.json configuration file. Please don't modify this
5 | * file for changing the settings, instead, modify defaults.json.
6 | * If you are using Swagger Editor as a dependency, Swagger Editor will make an
7 | * XHR request to '/config/defaults.json' to get it's settings.
8 | *******************************************************************************/
9 |
10 | /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "defaults" }]*/
11 | var defaults = {
12 | /*
13 | * Analytics section is used for user tracking configurations. At the moment
14 | * only Google Analytics is supported.
15 | */
16 | analytics: {
17 | google: {
18 | /*
19 | * Put your Google Analytics ID here
20 | */
21 | id: 'YOUR_GOOGLE_ANALYTICS_ID'
22 | }
23 | },
24 |
25 | /*
26 | * Folder that example files are located
27 | * Note that this string will be used in between two other url segments
28 | * so you always need the trailing and leading slashes
29 | */
30 | examplesFolder: 'spec-files/',
31 |
32 | /*
33 | * Ace editor options. This object will overload existing editor options.
34 | * See all possible options here: http://ace.c9.io/#nav=api&api=ace
35 | */
36 | editorOptions: {},
37 |
38 | /*
39 | * List of example files to show to user to pick from. The URL to fetch each
40 | * example is a combination of `examplesFolder` and file name
41 | */
42 | exampleFiles: [
43 | 'default.yaml',
44 | 'heroku-pets.yaml',
45 | 'minimal.yaml',
46 | 'petstore_simple.yaml',
47 | 'petstore_full.yaml',
48 | 'basic-auth.yaml',
49 | 'security.yaml'
50 | ],
51 |
52 | /*
53 | * Keywords for auto-complete are generated from a JavaScript object.
54 | * See keyword-map.js for object format
55 | */
56 | autocompleteExtension: {},
57 |
58 | /*
59 | * Change the default auto-complete mode
60 | */
61 | autoCompleteMode: 'Deployment-Manifest',
62 |
63 | /*
64 | * Change how many milliseconds after the last keypress the editor should
65 | * respond to change.
66 | */
67 | keyPressDebounceTime: 200,
68 |
69 | /*
70 | * Disables File menu which includes New, Open Example and Import commands
71 | */
72 | disableFileMenu: false,
73 |
74 | /*
75 | * When it's enabled:
76 | * * Editor will append `brandingCssClass` class to body tag
77 | * * Editor will include branding templates at
78 | * app/templates/branding-left.html and
79 | * app/templates/branding-left.html
80 | * to it's header
81 | */
82 | headerBranding: false,
83 |
84 | /*
85 | * Enables Try Operation functionality
86 | */
87 | enableTryIt: true,
88 |
89 | /*
90 | * When `headerBranding` is enabled, this will be appended to body tag
91 | */
92 | brandingCssClass: '',
93 |
94 | /*
95 | * Disables the overlay introduction panel
96 | */
97 | disableNewUserIntro: false,
98 |
99 | /*
100 | * When Editor imports a file from a URL, it will prepend this URL to make
101 | * it possible to import contents that are not allowed to be loaded from a
102 | * different origin. If you're hosting your own editor, please replace this
103 | */
104 | importProxyUrl: 'https://cors-it.herokuapp.com/?url=',
105 |
106 | /*
107 | * Use this base path for resolving JSON Pointers ($ref).
108 | * This value should be a valid URL.
109 | *
110 | * Example: http://example.com/swaggers
111 | *
112 | * More info: https://github.com/swagger-api/swagger-editor/issues/977#issuecomment-232254578
113 | */
114 | pointerResolutionBasePath: null
115 | };
116 |
--------------------------------------------------------------------------------
/docs/config.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | Configuration
4 | =============
5 |
6 | Swagger editor is configured from the file [`config/defaults.json`](../config/defaults.json).
7 | To learn more about this file, please review [`config/defaults.json.guide.js`](../config/defaults.json.guide.js).
8 |
9 | Custom UI
10 | ---------
11 |
12 | You can also enable `headerBranding` flag and serve `/templates/branding-left.html`
13 | and `/templates/branding-right.html` files to have custom header.
14 |
15 | It's possible to serve a custom CSS file at `/styles/branding.css` path to override editor's appearances.
16 |
17 | It's also possible to serve a custom JavaScript file at `/scripts/branding.js` to add
18 | new functionalities to Swagger Editor. Using branding HTML pieces and branding JavaScript
19 | file you can add new controllers to Swagger Editor.
20 |
21 | #### `disableFileMenu`
22 | Set to `true` to disable the editor menu
23 |
24 | #### `editorOptions`
25 | Ace editor options. This object will overload existing editor options.
26 | See all possible options [here](http://ace.c9.io/#nav=api&api=ace)
27 |
28 | #### `keyPressDebounceTime`
29 | Change how many milliseconds after the last keypress the editor should respond to change. Defaults to `200ms`.
30 |
31 | #### `disableNewUserIntro`
32 | Disables the overlay introduction panel. It's enabled by default.
33 |
34 | External Hooks
35 | --------------
36 |
37 | Swagger Editor provides an API for executing arbitrary code on certain events.
38 |
39 | To install a hook simply use `SwaggerEditor.on()` method. `.on()` method accepts two arguments,
40 | the first argument is the event name and the second argument is callback function that will be invoked when
41 | that event occurs.
42 |
43 | Here is a list of available event names:
44 |
45 | * `'code-change'`
46 | * `'put-success'`
47 | * `'put-failure`
48 |
49 | #### Example usage of external hooks
50 | ```js
51 | SwaggerEditor.on('put-failure', function() {
52 | alert('There was something wrong with saving your document.');
53 | });
54 | ```
55 |
56 | Backends
57 | --------
58 |
59 | #### `backendEndpoint`
60 | Url to a backend which supports `GET` for retrieving a OpenAPI Spec to edit
61 | and `PUT` for saving it.
62 |
63 | #### `useBackendForStorage`
64 | Set to ``true`` to enable a backend.
65 |
66 | #### `backendThrottle`
67 | The timeout for throttling backend calls. The default is 200 milliseconds
68 |
69 | #### `useYamlBackend`
70 | Set to ``true`` if the backend expects YAML, ``false`` will use JSON
71 |
72 | Analytics
73 | ---------
74 | `analytics` section in JSON configuration is used for user tracking configurations. At the moment only Google Analytics is supported.
75 |
76 | Example:
77 |
78 | ```js
79 | analytics: {
80 | google: {
81 | /*
82 | * Put your Google Analytics ID here
83 | */
84 | id: 'YOUR_GOOGLE_ANALYTICS_ID'
85 | }
86 | }
87 | ```
88 |
89 | Code Generation
90 | ---------------
91 |
92 | #### `disableCodeGen`
93 | Set to ``true`` to hide codegen links for clients and servers.
94 |
95 | #### `codegen`
96 | An object with keys ``servers``, ``clients``, ``server``, and ``client``. Each of with is a url to codegen service.
97 |
98 |
99 | Examples
100 | --------
101 |
102 | #### `examplesFolder`
103 | Path to a directory with examples specs. Note that this string will be used in between two other URL segments so you always need the trailing and leading slashes
104 |
105 | #### `exampleFiles`
106 | Array of strings. List files in ``exampleFolder`` that contain example specs. The first file is used as the default document for the editor when it is opened.
107 |
--------------------------------------------------------------------------------
/docs/cors.md:
--------------------------------------------------------------------------------
1 | # HTTP access control (CORS) issues
2 |
3 | Swagger Editor is a web application and by its nature is limited to [HTTP access control policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS). If you can't make calls using **Try this operation** component of the editor it's very likely because the server is not allowing the `editor.swagger.io` domain to make [`XHR`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) (also known as AJAX) calls to it.
4 |
5 | ## How to fix CORS issues
6 |
7 | There are multiple ways of fixing the CORS issue in Swagger Editor. You can modify your server if you own it or run Swagger Editor in an environment that ignores HTTP access control policy.
8 |
9 | ### Enable CORS in your server
10 |
11 | To enable CORS in your server you need to add following headers to your HTTP responses
12 |
13 |
14 | ```
15 | Access-Control-Allow-Origin: editor.swagger.io
16 | Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept
17 | ```
18 |
19 | Note that `Access-Control-Allow-Origin` accepts a regular expression. You can put `*` for its value to allow CORS calls from any domain(origin).
20 |
21 | ### Host Swagger Editor in your own domain
22 |
23 | If you don't want to add CORS headers to your server, the other option is to host Swagger Editor in your own domain. When Swagger Editor is running in the same domain as the API it's editing, it can make calls to your domain with no restriction. Run the following commands to generate a new build of Swagger Editor and serve the `dist` folder statically in your domain.
24 |
25 | When an XHR call is not cross-domain, JavaScript will see all the headers. If you want to see more accurate response, this method is preferred.
26 |
27 | ```
28 | git clone https://github.com/swagger-api/swagger-editor.git
29 | cd swagger-editor
30 | npm run build
31 |
32 | # now dist folder have a fresh build of Swagger Editor
33 | ```
34 |
35 | ### Proxy calls using a third party server
36 |
37 | You can make calls using a proxy to enable CORS for your API. Many API management providers provide proxies for enabling CORS. You can also run your own proxy. For example you can use [cors-it](https://github.com/mohsen1/cors-it) proxy if you're using Node.js.
38 |
39 | ### Run Swagger Editor in a browser that ignores HTTP access control
40 |
41 | Browsers have HTTP access control enabled by default but you can disable it in the setting.
42 |
43 | ##### Chrome
44 | To run Chrome with HTTP access control disabled use `--disable-web-security` flag.
45 |
46 | For example in OSX you need to run the following command:
47 |
48 | ```
49 | /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security --user-data-dir
50 | ```
51 |
--------------------------------------------------------------------------------
/docs/development.md:
--------------------------------------------------------------------------------
1 | # Development Guide
2 |
3 | ### Installing dependencies
4 | This app have npm dependencies. To install all dependencies, run
5 | ```shell
6 | npm install;
7 | ```
8 |
9 | ### Specifying the port
10 |
11 | You can set the environment variable `PORT` to set the port
12 |
13 | ```shell
14 | PORT=81 npm start
15 | ```
16 |
17 | ### Disallowing the browser to open
18 |
19 | Set `DO_NOT_OPEN` environment variable to start the server without
20 | opening the browser
21 |
22 | ```shell
23 | DO_NOT_OPEN=true npm start
24 | ```
25 |
26 | ### Running in production mode
27 |
28 | Pass `--production` flag to `npm start` to run in production mode
29 | ```shell
30 | npm start --production
31 |
32 | ```
33 |
34 | ### Building
35 | To build the project for production use, run:
36 |
37 | ```shell
38 | npm run build
39 | ```
40 | This will build a new version of the web app, ready for production
41 |
42 | ### Configuration
43 | Swagger Editor will make an XHR GET call to `/config/defaults.json` to get it's settings before launch. If you are using Swagger Editor as a dependency or serving it statically, you can provide your own `defaults.json` at this endpoint to override default settings.
44 |
45 | Swagger Editor is configured with a file, [`defaults.json`](../app/config/defaults.json).
46 | Read the [configuration guide](./config.md) and additional details
47 | in [`defaults.json.guide.js`](../app/config/defaults.json.guide.js)
48 | to learn how to configure Swagger Editor.
49 |
50 |
51 | ### Running with Docker
52 | If you are familiar with [Docker](https://www.docker.com/), a `Dockerfile` is
53 | provided.
54 |
55 | Build an image named `swagger-editor`
56 | ```shell
57 | sudo docker build -t swagger-editor .
58 | ```
59 |
60 | Run the container, using the local port 8080 (you may change this to any available
61 | port).
62 | ```shell
63 | sudo docker run -ti -p 8080:8080 swagger-editor
64 | ```
65 | And open [http://localhost:8080](http://localhost:8080) in your browser
66 |
67 | ### Code Style
68 | Code style is enforced by ESLint. Build will fail if changes in code is not following code style guildlines.
69 |
70 | ### Testing
71 | To run all tests run
72 |
73 | ```shell
74 | npm test
75 | ```
76 |
77 | This will build and run unit tests then if it was successful, it will run end-to-end tests.
78 |
79 | #### Unit tests
80 | All unit tests are located in [`../test/unit`](../test/unit). Unit tests are written in Jasmine and run by Karma. To run unit tests, run
81 |
82 | ```shell
83 | npm run unit-test
84 | ```
85 |
86 | For developing unit tests, run
87 | ```shell
88 | npm run unit-test-watch
89 | ```
90 | This will keep test browser and test watcher open and watches for file changes to re-run tests.
91 |
92 | #### End-to-end tests
93 | All end-to-end tests are located in [`../test/e2e`](../test/e2e). To run end-to-end test, run
94 |
95 | ```shell
96 | grunt protr
97 | npm run e2e-test
98 | This will run [Protractor](http://angular.github.io/protractor/#/) end-to-end test.
99 |
--------------------------------------------------------------------------------
/docs/dnd.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamlo/bosh-editor/a3b27e037feb5f18dff208f446daca8b526b4eb2/docs/dnd.gif
--------------------------------------------------------------------------------
/docs/import.md:
--------------------------------------------------------------------------------
1 | # Importing OpenAPI Specs
2 |
3 | Swagger Editor can import your OpenAPI Spec file. OpenAPI Specs can be in JSON or YAML.
4 |
5 | ### File → Import File
6 |
7 | Click **Choose File** and select import. The file you are importing have to be valid JSON or YAML OpenAPI Spec file. Swagger Editor will prompt you about validation errors.
8 |
9 | ### File → Import URL
10 |
11 | Paste in URL to your OpenAPI Spec file. Swagger Editor will use a CORS proxy to download files that are being served with a server that doesn't support XHR calls from other domains. This might not work for locally hosted files, or files that are behind a firewall. Turn the **Use CORS proxy** check-box to disable this feature.
12 |
13 | ### URL Query Parameter
14 |
15 | You can also import an existing YAML or JSON Swagger 2.0 specs document by using the `import` query parameter.
16 |
17 | Note that the query parameter is in fragment section of the URL. After `/#/?`. It's because Swagger Editor is importing the file in the client side.
18 |
19 | For example:
20 | ```
21 | http://editor.swagger.io/#/?import=http://generator.swagger.io/api/swagger.json
22 | ```
23 |
24 | Swagger Editor will try to use a CORS proxy server for downloading your YAML. To disable this proxy server pass `no-proxy` query parameter
25 |
26 | ```
27 | http://editor.swagger.io/#/?import=localhost:8000/swagger.yaml&no-proxy
28 | ```
29 |
30 | ### Drag and Drop
31 |
32 | Simply drop your Swagger JSON or YAML files into Swagger Editor browser window.
33 |
34 | 
35 |
--------------------------------------------------------------------------------
/docs/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamlo/bosh-editor/a3b27e037feb5f18dff208f446daca8b526b4eb2/docs/screenshot.png
--------------------------------------------------------------------------------
/images/close.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
--------------------------------------------------------------------------------
/images/edit-pencil.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
--------------------------------------------------------------------------------
/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamlo/bosh-editor/a3b27e037feb5f18dff208f446daca8b526b4eb2/images/favicon.ico
--------------------------------------------------------------------------------
/images/jump-icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
--------------------------------------------------------------------------------
/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamlo/bosh-editor/a3b27e037feb5f18dff208f446daca8b526b4eb2/images/logo.png
--------------------------------------------------------------------------------
/images/overlay-arrow.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | BOSH Editor
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |