Skip to content

Commit

Permalink
Merge pull request #4 from swagger-api/master
Browse files Browse the repository at this point in the history
update swagger-ui
  • Loading branch information
afdia authored Mar 3, 2017
2 parents e5f1d54 + ccf7f03 commit 9d0e5fe
Show file tree
Hide file tree
Showing 59 changed files with 1,872 additions and 12,047 deletions.
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
sudo: false
language: node_js
services:
- docker
node_js:
- '4.2'
install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm i -g jshint
- npm install
env:
- DOCKER_IMAGE_NAME=swaggerapi/swagger-ui
after_success:
- if [ $DOCKER_HUB_USERNAME ]; then
docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD;
docker build -t $DOCKER_IMAGE_NAME .;
if [ "$TRAVIS_TAG" != "master" && -z "$TRAVIS_TAG"]; then
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:$TRAVIS_TAG;
fi;

docker push $DOCKER_IMAGE_NAME;
fi;
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM alpine:3.3
FROM alpine:3.4

MAINTAINER Roman Tarnavski

RUN apk add --update nginx
RUN mkdir -p /run/nginx

COPY nginx.conf /etc/nginx/
ADD ./dist/ /usr/share/nginx/html

EXPOSE 8080

CMD nginx -g 'daemon off;'
CMD exec nginx -g 'daemon off;'
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Swagger UI is part of the Swagger project. The Swagger project allows you to produce, visualize and consume your OWN RESTful services. No proxy or 3rd party services required. Do it your own way.

Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically
Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically
generate beautiful documentation and sandbox from a Swagger-compliant API. Because Swagger UI has no dependencies, you can host it in any server environment, or on your local machine.

## What's Swagger?
Expand All @@ -24,12 +24,14 @@ The OpenAPI Specification has undergone 4 revisions since initial creation in 20

Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
------------------ | ------------ | -------------------------- | ----- | ------
2.2.6 | 2016-10-14 | 1.1, 1.2, 2.0 | [tag v2.2.6](https://github.com/swagger-api/swagger-ui/tree/v2.2.6) |
2.2.10 | 2017-01-04 | 1.1, 1.2, 2.0 | [tag v2.2.10](https://github.com/swagger-api/swagger-ui/tree/v2.2.10) |
2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5) |
2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) |
1.0.13 | 2013-03-08 | 1.1, 1.2 | [tag v1.0.13](https://github.com/swagger-api/swagger-ui/tree/v1.0.13) |
1.0.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1) |

**Note:** Support for versions older than 1.2 is limited and you may experience issues we cannot improve and support. We highly recommend that you upgrade your spec to the latest version.

## How to Use It

### Download
Expand All @@ -41,7 +43,8 @@ Swagger UI works in all evergreen desktop browsers (Chrome, Safari, Firefox). In
### Build
You can rebuild swagger-ui on your own to tweak it or just so you can say you did. To do so, follow these steps:

### Windows Users: Please install [Python](https://www.python.org/downloads/windows/) before follow below guidelines for node-gyp rebuild to run.
* Ensure you have `nodejs` 4.0 or greater installed, and on your classpath.
* Windows Users: Please install [Python](https://www.python.org/downloads/windows/) before following the guidelines below for node-gyp rebuild to run.

1. `npm install`
2. `npm run build`
Expand All @@ -50,9 +53,16 @@ You can rebuild swagger-ui on your own to tweak it or just so you can say you di
### Development
Use `npm run serve` to make a new build, watch for changes, and serve the result at http://localhost:8080/.

### Running with Docker

```
docker pull swaggerapi/swagger-ui
docker run -p 80:8080 swaggerapi/swagger-ui
```

### Build using Docker

To build swagger-ui using a docker container:
To build swagger-ui using a Docker container:

```
docker build -t swagger-ui-builder .
Expand All @@ -62,7 +72,7 @@ docker run -p 80:8080 swagger-ui-builder
This will start Swagger UI at `http://localhost`.

### Use
Once you open the Swagger UI, it will load the [Swagger Petstore](http://petstore.swagger.io/v2/swagger.json) service and show its APIs. You can enter your own server url and click explore to view the API.
Once you open the Swagger UI, it will load the [Swagger Petstore](http://petstore.swagger.io/v2/swagger.json) service and show its APIs. You can enter your own server url and click 'Explore' to view the API.

### Customize
You may choose to customize Swagger UI for your organization. Here is an overview of what's in its various directories:
Expand Down Expand Up @@ -142,9 +152,9 @@ swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorizat
Note! You can pass multiple header params on a single request, just use unique names for them (`key` is used in the above example).

### Localization and translation
The localization files are in the [lang](/lang) directory. Note that language files and translator is not included in SwaggerUI by default. You need to add them manually.
The localization files are in the [lang](/lang) directory. Note that language files and translator are not included in SwaggerUI by default. You need to add them manually.

To enable translation you should append next two lines in your Swagger's index.html (or another entry point you use)
To enable translation, you should append the next two lines in your Swagger's index.html (or another entry point you use)
```html
<script src='lang/translator.js' type='text/javascript'></script>
<script src='lang/en.js' type='text/javascript'></script>
Expand All @@ -169,7 +179,7 @@ At this moment only inner html, title-attribute and value-attribute are going to
## CORS Support
### OR: How to deal with "Can't read from server. It may not have the appropriate access-control-origin settings."

CORS is a technique to prevent websites from doing bad things with your personal data. Most browsers + javascript toolkits not only support CORS but enforce it, which has implications for your API server which supports Swagger.
CORS is a technique to prevent websites from doing bad things with your personal data. Most browsers + JavaScript toolkits not only support CORS but enforce it, which has implications for your API server which supports Swagger.

You can read about CORS here: http://www.w3.org/TR/cors.

Expand Down
46 changes: 23 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"name": "swagger-api/swagger-ui",
"description": "Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
"keywords": [
"Swagger",
"OpenAPI",
"specification",
"documentation",
"API",
"UI"
],
"homepage": "http://swagger.io",
"license": "Apache-2.0",
"authors": [
{
"name": "Tony Tam",
"email": "fehguy@gmail.com"
},
{
"name": "Mohsen Azimi",
"email": "me@azimi.me"
}
]
}
"name": "swagger-api/swagger-ui",
"description": "Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
"keywords": [
"Swagger",
"OpenAPI",
"specification",
"documentation",
"API",
"UI"
],
"homepage": "http://swagger.io",
"license": "Apache-2.0",
"authors": [
{
"name": "Tony Tam",
"email": "fehguy@gmail.com"
},
{
"name": "Mohsen Azimi",
"email": "me@azimi.me"
}
]
}
Loading

0 comments on commit 9d0e5fe

Please sign in to comment.