You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-23Lines changed: 34 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,16 +18,17 @@ This repo publishes to two different NPM packages:
18
18
For the older version of swagger-ui, refer to the [*2.x branch*](https://github.com/swagger-api/swagger-ui/tree/2.x).
19
19
20
20
## 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:
22
22
23
-
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
@@ -67,7 +68,6 @@ To help with the migration, here are the currently known issues with 3.X. This l
67
68
68
69
- Only part of the [parameters](#parameters) previously supported are available.
69
70
- The JSON Form Editor is not implemented.
70
-
- Shebang URL support for operations is missing.
71
71
- Support for `collectionFormat` is partial.
72
72
- l10n (translations) is not implemented.
73
73
- 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
82
82
83
83
```javascript
84
84
constui=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
+
})
96
96
```
97
97
98
98
#### OAuth2 configuration
99
99
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`.
101
102
102
103
Config Name | Description
103
104
--- | ---
@@ -107,6 +108,7 @@ realm | realm query parameter (for oauth1) added to `authorizationUrl` and `toke
107
108
appName | application name, displayed in authorization popup. MUST be a string
108
109
scopeSeparator | scope separator for passing scopes, encoded before calling, default value is a space (encoded value `%20`). MUST be a string
109
110
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`
110
112
111
113
```
112
114
const ui = SwaggerUIBundle({...})
@@ -136,14 +138,19 @@ urls.primaryName | When using `urls`, you can use this subparameter. If the valu
136
138
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.
137
139
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.
138
140
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`.
139
142
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.
140
144
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.
141
145
configUrl | Configs URL
142
146
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
143
147
modelPropertyMacro | MUST be a function. Function to set default values to each property in model. Accepts one argument modelPropertyMacro(property), property is immutable
144
148
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'.
145
149
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)
Only headers with these names will be allowed to be sent by Swagger-UI.
235
242
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.
0 commit comments