Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config docs #199

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 23 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,29 @@ grunt serve

This will open a browser window running current development version.

#### Configuration

See [./docs/config.rst](./docs/config.rst)


### Run with Docker

If you are familiar with [Docker](https://www.docker.com/), a `Dockerfile` is
provided.

Build an image named `swagger-editor`
```
sudo docker build -t swagger-editor .
```

Run the container, using the local port 8080 (you may change this to any available
port).
```
sudo docker run -ti -p 8080:9000 swagger-editor
```
And open [http://localhost:8080](http://localhost:8080) in your browser


## Building and publishing

#### Building
Expand All @@ -68,30 +91,6 @@ $ grunt ship
```
Please do not touch `gh-pages` branch manually!

### Docker Container

If you are familiar with [Docker](https://www.docker.com/), you can build a
Docker image of the current code using the project's Dockerfile. From the root
of the repo run:

```
sudo docker build -t my-swagger-editor .
```

Where `my-swagger-editor` is the tag for the image.

To run the image as a Docker container, use the following:

```
sudo docker run -ti -p 8080:9000 my-swagger-editor
```

And open [http://localhost:8080](http://localhost:8080) in your browser. Port
8080 in this example may be any available port.

If you want to know more about the process to build the images, go to the
[Docker Node.js Sample tutorial](https://docs.docker.com/examples/nodejs_web_app/).

### Contributing
File issues in GitHub's to report bugs or issue a pull request.

Expand Down
16 changes: 9 additions & 7 deletions app/scripts/enums/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@
PhonicsApp.config(['$provide', function ($provide) {
$provide.constant('defaults',

// BEGIN-DEFAUNTAS-JSON
// BEGIN-DEFAULTS-JSON
{
downloadZipUrl: 'http://generator.wordnik.com/online/api/gen/download/',
codegen: {
servers: 'http://generator.wordnik.com/online/api/gen/servers',
clients: 'http://generator.wordnik.com/online/api/gen/clients',
server: 'http://generator.wordnik.com/online/api/gen/servers/{language}',
client: 'http://generator.wordnik.com/online/api/gen/clients/{language}'
},
schemaUrl: '',
disableCodeGen: true,

examplesFolder: '/spec-files/',
exampleFiles: ['default.yaml', 'minimal.yaml', 'heroku-pets.yaml', 'petstore.yaml'],

backendEndpoint: '/editor/spec',
useBackendForStorage: false,
backendHelathCheckTimeout: 5000,
disableFileMenu: false,
disableCodeGen: true,
useYamlBackend: false,
headerBranding: false,
brandingCssClass: ''

disableFileMenu: false,
headerBranding: true,
brandingCssClass: '',
schemaUrl: ''
}
// END-DEFAULTS-JSON

Expand Down
22 changes: 11 additions & 11 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
"version": "0.0.0",
"devDependencies": {
"angular": "1.2.15",
"json3": "~3.2.6",
"es5-shim": "~2.1.0",
"angular-resource": "1.2.15",
"angular-cookies": "1.2.15",
"angular-sanitize": "1.2.15",
"ngstorage": "~0.3.0",
"jquery": "2.1.1",
"angular-bootstrap": "~0.11.0",
"tv4": "~1.0.17",
"angular-cookies": "1.2.15",
"angular-marked": "Hypercubed/angular-marked#~0.0.12",
"angular-mocks": "1.2.15",
"angular-resource": "1.2.15",
"angular-sanitize": "1.2.15",
"angular-scenario": "1.2.15",
"angular-ui-ace": "bower",
"angular-ui-router": "~0.2.10",
"angular-marked": "Hypercubed/angular-marked#~0.0.12",
"bootstrap": "~3.2.0",
"es5-shim": "~2.1.0",
"jquery": "2.1.1",
"js-yaml": "~3.2.2",
"json3": "~3.2.6",
"lodash": "~2.4.1",
"yaml-js": "mohsen1/yaml-js",
"js-yaml": "~3.2.2"
"ngstorage": "~0.3.0",
"tv4": "~1.0.17",
"yaml-js": "mohsen1/yaml-js"
},
"dependencies": {
"json-formatter": "*",
Expand Down
77 changes: 77 additions & 0 deletions docs/config.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@


Configuration
=============

Swagger editor is configured from the file ``app/scripts/enums/default.js``.


Backends
--------

backendEndpoint
Url to a backend which supports ``GET`` for retrieving a swagger spec to edit
and ``PUT`` for saving it.

useBackendForStorage
Set to ``true`` to enable a backend.

backendHelathCheckTimeout
Timeout in millseconds of the http request to healthchecks the backend

.. note::
This healthcheck is actually hitting location.href, not the url
specified by backendEndpoint

useYamlBackend
Set to ``true`` if the backend expects YAML, ``false`` will use JSON

.. note::
``Storage.save()`` is only ever called with yaml so this probably does
nothing if set to ``false``

Visual Style
------------

disableFileMenu
Set to ``true`` to disable the editor menu

headerBranding
Include the contents of ``app/templates/branding-left.html`` and
``app/templates/branding-right.html`` in the header.

brandingCssClass
css class to apply to the body tag

.. warning::
This setting is deprecated, it will be removed in a future release.


Code Generation
---------------

disableCodeGen
Set to ``true`` to hide codegen links for clients and servers.

codegen
An object with keys ``servers``, ``clients``, ``server``, and ``client``. Each of
with is a url to (TODO: to what?)


Examples
--------

examplesFolder
Path to a directory with example specs

exampleFiles
List of files in ``exampleFolder`` that contain example specs. The first file
is used as the default document for the editor when it is opened.


Swagger Validation
------------------

schemaUrl
Url of the swagger spec schema, defaults to the schema provided in
``app/scripts/enums/swagger-json-schema.js``.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"repository": "https://github.com/wordnik/swagger-editor.git",
"dependencies": {},
"devDependencies": {
"grunt-concurrent": "^1.0.0",
"grunt-contrib-concat": "~0.3.0",
"bower": "~1.3.9",
"grunt": "~0.4.4",
"grunt-autoprefixer": "~0.4.0",
"grunt-bower-install": "~1.0.0",
"grunt-cli": "~0.1.13",
"grunt-concurrent": "^1.0.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-cssmin": "~0.7.0",
Expand Down