Skip to content

Commit 40a8376

Browse files
authored
Merge branch 'master' into lock-client-version
2 parents 5b76735 + 7f01d05 commit 40a8376

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+366
-7086
lines changed

.babelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"stage-0"
66
],
77
"plugins": [
8+
"transform-runtime",
89
[
910
"module-alias",
1011
[

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"rules": {
2323
"semi": [2, "never"],
2424
"strict": 0,
25-
"quotes": 2,
25+
"quotes": [2, "double", { "allowTemplateLiterals": true }],
2626
"no-unused-vars": 2,
2727
"no-multi-spaces": 1,
2828
"camelcase": 1,

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker-run.sh text eol=lf

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules
44
.DS_Store
55
npm-debug.log*
66
.eslintcache
7+
package-lock.json

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.4
1+
FROM alpine:3.5
22

33
MAINTAINER fehguy
44

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,23 @@
66

77
**This is the new version of swagger-ui, 3.x. Want to learn more? Check out our [FAQ](http://swagger.io/new-ui-faq/).**
88

9+
**👉🏼 Want to score an easy open-source contribution?** Check out our [Good first contribution](https://github.com/swagger-api/swagger-ui/issues?q=is%3Aissue+is%3Aopen+label%3A%22Good+first+contribution%22) label.
10+
911
As a brand new version, written from the ground up, there are some known issues and unimplemented features. Check out the [Known Issues](#known-issues) section for more details.
1012

13+
This repo publishes to two different NPM packages:
14+
15+
* [swagger-ui](https://www.npmjs.com/package/swagger-ui) is intended for use as a node module.
16+
* [swagger-ui-dist](https://www.npmjs.com/package/swagger-ui-dist) comes pre-bundled with all dependencies and can be incorporated directly in a webapp.
17+
1118
For the older version of swagger-ui, refer to the [*2.x branch*](https://github.com/swagger-api/swagger-ui/tree/2.x).
1219

1320
## Compatibility
1421
The OpenAPI Specification has undergone 4 revisions since initial creation in 2010. Compatibility between swagger-ui and the OpenAPI Specification is as follows:
1522

1623
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
1724
------------------ | ------------ | -------------------------- | ----- | ------
18-
3.0.12 | 2017-03-19 | 2.0 | [tag v3.0.12](https://github.com/swagger-api/swagger-ui/tree/v3.0.12) |
25+
3.0.16 | 2017-06-17 | 2.0 | [tag v3.0.16](https://github.com/swagger-api/swagger-ui/tree/v3.0.16) |
1926
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) |
2027
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) |
2128
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) |
@@ -35,6 +42,12 @@ docker run -p 80:8080 swaggerapi/swagger-ui
3542

3643
Will start nginx with swagger-ui on port 80.
3744

45+
Or you can provide your own swagger.json on your host
46+
47+
```
48+
docker run -p 80:8080 -e "SWAGGER_JSON=/foo/swagger.json" -v /bar:/foo swaggerapi/swagger-ui
49+
```
50+
3851
##### Prerequisites
3952
- Node 6.x
4053
- NPM 3.x
@@ -59,6 +72,11 @@ To help with the migration, here are the currently known issues with 3.X. This l
5972
- l10n (translations) is not implemented.
6073
- Relative path support for external files is not implemented.
6174

75+
### Direct use of JS and CSS assets
76+
To include the JS, CSS and image assets directly into a webpage, use the [swagger-ui-dist](https://www.npmjs.com/package/swagger-ui-dist) package.
77+
The root directory of this package contains the contents of the _dist/_ directory of this repo.
78+
As a node module, `swagger-ui-dist` also exports the `swagger-ui-bundle` and `swagger-ui-standalone-preset` objects.
79+
6280
### SwaggerUIBundle
6381
To use swagger-ui's bundles, you should take a look at the [source of swagger-ui html page](https://github.com/swagger-api/swagger-ui/blob/master/dist/index.html) and customize it. This basically requires you to instantiate a SwaggerUi object as below:
6482

@@ -83,11 +101,11 @@ default `client_id` and `client_secret`, `realm`, an application name `appName`,
83101

84102
Config Name | Description
85103
--- | ---
86-
client_id | Default clientId. MUST be a string
87-
client_secret | Default clientSecret. MUST be a string
104+
client_id | Default clientId. MUST be a string
105+
client_secret | Default clientSecret. MUST be a string
88106
realm | realm query parameter (for oauth1) added to `authorizationUrl` and `tokenUrl` . MUST be a string
89107
appName | application name, displayed in authorization popup. MUST be a string
90-
scopeSeparator | scope separator for passing scopes, encoded before calling, default value is a space (encoded value `%20`). MUST be a string
108+
scopeSeparator | scope separator for passing scopes, encoded before calling, default value is a space (encoded value `%20`). MUST be a string
91109
additionalQueryStringParams | Additional query parameters added to `authorizationUrl` and `tokenUrl`. MUST be an object
92110

93111
```
@@ -119,6 +137,8 @@ operationsSorter | Apply a sort to the operation list of each API. It can be 'al
119137
configUrl | Configs URL
120138
parameterMacro | MUST be a function. Function to set default value to parameters. Accepts two arguments parameterMacro(operation, parameter). Operation and parameter are objects passed for context, both remain immutable
121139
modelPropertyMacro | MUST be a function. Function to set default values to each property in model. Accepts one argument modelPropertyMacro(property), property is immutable
140+
docExpansion | Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), 'full' (expands the tags and operations) or 'none' (expands nothing). The default is 'list'.
141+
displayOperationId | Controls the display of operationId in operations list. The default is `false`.
122142

123143
### Plugins
124144

@@ -138,7 +158,7 @@ let preset = [
138158
```
139159

140160
#### Configs plugin
141-
Configs plugin allows to fetch external configs instead of passing them to `SwaggerUIBundle`. Fetched configs support two formats: JSON or yaml. The plugin is enabled by default.
161+
Configs plugin allows to fetch external configs instead of passing them to `SwaggerUIBundle`. Fetched configs support two formats: JSON or yaml. The plugin is enabled by default.
142162
There are three options of passing config:
143163
- add a query parameter `config` with URL to a server where the configs are hosted. For ex. http://petstore.swagger.io/?config=http://localhost:3001/config.yaml
144164
- add a config `configUrl` with URL to SwaggerUIBundle

dist/oauth2-redirect.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
function run () {
99
var oauth2 = window.opener.swaggerUIRedirectOauth2;
1010
var sentState = oauth2.state;
11+
var redirectUrl = oauth2.redirectUrl;
1112
var isValid, qp, arr;
1213

1314
qp = (window.location.hash || location.search).substring(1);
@@ -35,7 +36,7 @@
3536
if (qp.code) {
3637
delete oauth2.state;
3738
oauth2.auth.code = qp.code;
38-
oauth2.callback(oauth2.auth);
39+
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
3940
} else {
4041
oauth2.errCb({
4142
authId: oauth2.auth.name,
@@ -45,9 +46,8 @@
4546
});
4647
}
4748
} else {
48-
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid});
49+
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
4950
}
5051
window.close();
5152
}
52-
5353
</script>

dist/swagger-ui-bundle.js

Lines changed: 41 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui-bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui-standalone-preset.js

Lines changed: 11 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)