Skip to content

Commit 0a20d72

Browse files
authored
Merge branch 'master' into ft/oas3
2 parents 758a229 + 8633372 commit 0a20d72

File tree

96 files changed

+1773
-1164
lines changed

Some content is hidden

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

96 files changed

+1773
-1164
lines changed

.gitignore

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

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ deploy:
1616
1717
skip_cleanup: true
1818
api_key:
19-
secure: "IJkLaACa+rfERf1O5nwlqOyuo9sbul3FBhBt4Un9P+DvEet3AoDPV9NQVLd8SkmQYKGbGQWF4BIdjrO5nqFD6Te+JTeUX5Uo/DFS/fu9qw1xv0dQpvbJFuoYnnFlbzGTEs4CFa8lbu3ZromFHQGOQxRobjsG1Kf0dWFSSzmND3g="
19+
secure: "YKk5L1BL4oAixvLjWp+i85fNFXK85HKOlUt6QypkZkt23My5aywuYsv5VCLjjOtuWc72zbmOzP82DTBsuRswCRViXWCiNYhl42QTdvadHu0uIlM/FL6aNlvPpzXIws4bMvz1aYOTzFTnSnNuvCTzF1daW0+2ClOo3r0nLEdDfFg="
2020
on:
2121
tags: true
2222
repo: swagger-api/swagger-ui

README.md

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@ This repo publishes to two different NPM packages:
1818
For the older version of swagger-ui, refer to the [*2.x branch*](https://github.com/swagger-api/swagger-ui/tree/2.x).
1919

2020
## Compatibility
21-
The OpenAPI Specification has undergone 4 revisions since initial creation in 2010. Compatibility between swagger-ui and the OpenAPI Specification is as follows:
21+
The OpenAPI Specification has undergone 5 revisions since initial creation in 2010. Compatibility between swagger-ui and the OpenAPI Specification is as follows:
2222

23-
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
24-
------------------ | ------------ | -------------------------- | ----- | ------
25-
3.0.17 | 2017-06-23 | 2.0 | [tag v3.0.17](https://github.com/swagger-api/swagger-ui/tree/v3.0.17) |
26-
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) |
27-
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) |
28-
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) |
29-
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) |
30-
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) |
23+
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes
24+
------------------ | ------------ | -------------------------- | -----
25+
3.1.2 | 2017-07-31 | 2.0, 3.0 | [tag v3.1.2](https://github.com/swagger-api/swagger-ui/tree/v3.1.2)
26+
3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21)
27+
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)
28+
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)
29+
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)
30+
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)
31+
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)
3132

3233

3334
### How to run
@@ -67,7 +68,6 @@ To help with the migration, here are the currently known issues with 3.X. This l
6768

6869
- Only part of the [parameters](#parameters) previously supported are available.
6970
- The JSON Form Editor is not implemented.
70-
- Shebang URL support for operations is missing.
7171
- Support for `collectionFormat` is partial.
7272
- l10n (translations) is not implemented.
7373
- Relative path support for external files is not implemented.
@@ -82,22 +82,23 @@ To use swagger-ui's bundles, you should take a look at the [source of swagger-ui
8282

8383
```javascript
8484
const ui = SwaggerUIBundle({
85-
url: "http://petstore.swagger.io/v2/swagger.json",
86-
dom_id: '#swagger-ui',
87-
presets: [
88-
SwaggerUIBundle.presets.apis,
89-
SwaggerUIStandalonePreset
90-
],
91-
plugins: [
92-
SwaggerUIBundle.plugins.DownloadUrl
93-
],
94-
layout: "StandaloneLayout"
95-
})
85+
url: "http://petstore.swagger.io/v2/swagger.json",
86+
dom_id: '#swagger-ui',
87+
presets: [
88+
SwaggerUIBundle.presets.apis,
89+
SwaggerUIStandalonePreset
90+
],
91+
plugins: [
92+
SwaggerUIBundle.plugins.DownloadUrl
93+
],
94+
layout: "StandaloneLayout"
95+
})
9696
```
9797

9898
#### OAuth2 configuration
9999
You can configure OAuth2 authorization by calling `initOAuth` method with passed configs under the instance of `SwaggerUIBundle`
100-
default `client_id` and `client_secret`, `realm`, an application name `appName`, `scopeSeparator`, `additionalQueryStringParams`.
100+
default `client_id` and `client_secret`, `realm`, an application name `appName`, `scopeSeparator`, `additionalQueryStringParams`,
101+
`useBasicAuthenticationWithAccessCodeGrant`.
101102

102103
Config Name | Description
103104
--- | ---
@@ -107,6 +108,7 @@ realm | realm query parameter (for oauth1) added to `authorizationUrl` and `toke
107108
appName | application name, displayed in authorization popup. MUST be a string
108109
scopeSeparator | scope separator for passing scopes, encoded before calling, default value is a space (encoded value `%20`). MUST be a string
109110
additionalQueryStringParams | Additional query parameters added to `authorizationUrl` and `tokenUrl`. MUST be an object
111+
useBasicAuthenticationWithAccessCodeGrant | Only activated for the `accessCode` flow. During the `authorization_code` request to the `tokenUrl`, pass the [Client Password](https://tools.ietf.org/html/rfc6749#section-2.3.1) using the HTTP Basic Authentication scheme (`Authorization` header with `Basic base64encoded[client_id:client_secret]`). The default is `false`
110112

111113
```
112114
const ui = SwaggerUIBundle({...})
@@ -136,14 +138,19 @@ urls.primaryName | When using `urls`, you can use this subparameter. If the valu
136138
spec | A JSON object describing the OpenAPI Specification. When used, the `url` parameter will not be parsed. This is useful for testing manually-generated specifications without hosting them.
137139
validatorUrl | By default, Swagger-UI attempts to validate specs against swagger.io's online validator. You can use this parameter to set a different validator URL, for example for locally deployed validators ([Validator Badge](https://github.com/swagger-api/validator-badge)). Setting it to `null` will disable validation.
138140
dom_id | The id of a dom element inside which SwaggerUi will put the user interface for swagger.
141+
domNode | The HTML DOM element inside which SwaggerUi will put the user interface for swagger. Overrides `dom_id`.
139142
oauth2RedirectUrl | OAuth redirect URL
143+
tagsSorter | Apply a sort to the tag list of each API. It can be 'alpha' (sort by paths alphanumerically) or a function (see [Array.prototype.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) to learn how to write a sort function). Two tag name strings are passed to the sorter for each pass. Default is the order determined by Swagger-UI.
140144
operationsSorter | Apply a sort to the operation list of each API. It can be 'alpha' (sort by paths alphanumerically), 'method' (sort by HTTP method) or a function (see Array.prototype.sort() to know how sort function works). Default is the order returned by the server unchanged.
141145
configUrl | Configs URL
142146
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
143147
modelPropertyMacro | MUST be a function. Function to set default values to each property in model. Accepts one argument modelPropertyMacro(property), property is immutable
144148
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'.
145149
displayOperationId | Controls the display of operationId in operations list. The default is `false`.
146-
displayRequestDuration | Controls the display of the request duration (in milliseconds) for `Try it out` requests. The default is `false`.
150+
displayRequestDuration | Controls the display of the request duration (in milliseconds) for `Try it out` requests. The default is `false`.
151+
maxDisplayedTags | If set, limits the number of tagged operations displayed to at most this many. The default is to show all operations.
152+
filter | If set, enables filtering. The top bar will show an edit box that you can use to filter the tagged operations that are shown. Can be true/false to enable or disable, or an explicit filter string in which case filtering will be enabled using that string as the filter expression. Filtering is case sensitive matching the filter expression anywhere inside the tag.
153+
deepLinking | If set to `true`, enables dynamic deep linking for tags and operations. [Docs](https://github.com/swagger-api/swagger-ui/blob/master/docs/deep-linking.md)
147154

148155
### Plugins
149156

@@ -233,6 +240,10 @@ Access-Control-Allow-Headers: Content-Type, api_key, Authorization
233240

234241
Only headers with these names will be allowed to be sent by Swagger-UI.
235242

243+
## Security contact
244+
245+
Please disclose any security-related issues or vulnerabilities by emailing [[email protected]](mailto:[email protected]), instead of using the public issue tracker.
246+
236247
## License
237248

238249
Copyright 2017 SmartBear Software

dev-helpers/index.html

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
<style>
1212
html
1313
{
14-
box-sizing: border-box;
15-
overflow: -moz-scrollbars-vertical;
16-
overflow-y: scroll;
14+
box-sizing: border-box;
15+
overflow: -moz-scrollbars-vertical;
16+
overflow-y: scroll;
1717
}
1818
*,
1919
*:before,
2020
*:after
2121
{
22-
box-sizing: inherit;
22+
box-sizing: inherit;
2323
}
2424

2525
body {
@@ -34,7 +34,7 @@
3434
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
3535
<defs>
3636
<symbol viewBox="0 0 20 20" id="unlocked">
37-
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
37+
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
3838
</symbol>
3939

4040
<symbol viewBox="0 0 20 20" id="locked">
@@ -70,34 +70,34 @@
7070
<script src="./swagger-ui-bundle.js"> </script>
7171
<script src="./swagger-ui-standalone-preset.js"> </script>
7272
<script>
73-
window.onload = function() {
74-
window["SwaggerUIBundle"] = window["swagger-ui-bundle"]
75-
window["SwaggerUIStandalonePreset"] = window["swagger-ui-standalone-preset"]
76-
// Build a system
77-
const ui = SwaggerUIBundle({
78-
url: "http://petstore.swagger.io/v2/swagger.json",
79-
dom_id: '#swagger-ui',
80-
presets: [
81-
SwaggerUIBundle.presets.apis,
82-
SwaggerUIStandalonePreset
83-
],
84-
plugins: [
85-
SwaggerUIBundle.plugins.DownloadUrl
86-
],
87-
layout: "StandaloneLayout"
88-
})
89-
90-
window.ui = ui
91-
92-
ui.initOAuth({
93-
clientId: "your-client-id",
94-
clientSecret: "your-client-secret-if-required",
95-
realm: "your-realms",
96-
appName: "your-app-name",
97-
scopeSeparator: " ",
98-
additionalQueryStringParams: {}
99-
})
100-
}
73+
window.onload = function() {
74+
window["SwaggerUIBundle"] = window["swagger-ui-bundle"]
75+
window["SwaggerUIStandalonePreset"] = window["swagger-ui-standalone-preset"]
76+
// Build a system
77+
const ui = SwaggerUIBundle({
78+
url: "http://petstore.swagger.io/v2/swagger.json",
79+
dom_id: '#swagger-ui',
80+
presets: [
81+
SwaggerUIBundle.presets.apis,
82+
SwaggerUIStandalonePreset
83+
],
84+
plugins: [
85+
SwaggerUIBundle.plugins.DownloadUrl
86+
],
87+
layout: "StandaloneLayout"
88+
})
89+
90+
window.ui = ui
91+
92+
ui.initOAuth({
93+
clientId: "your-client-id",
94+
clientSecret: "your-client-secret-if-required",
95+
realm: "your-realms",
96+
appName: "your-app-name",
97+
scopeSeparator: " ",
98+
additionalQueryStringParams: {}
99+
})
100+
}
101101
</script>
102102
</body>
103103

dist/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
const ui = SwaggerUIBundle({
7777
url: "http://petstore.swagger.io/v2/swagger.json",
7878
dom_id: '#swagger-ui',
79+
deepLinking: true,
7980
presets: [
8081
SwaggerUIBundle.presets.apis,
8182
SwaggerUIStandalonePreset

dist/swagger-ui-bundle.js

Lines changed: 11 additions & 11 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.

0 commit comments

Comments
 (0)