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
+14-12Lines changed: 14 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,6 @@ To help with the migration, here are the currently known issues with 3.X. This l
67
67
68
68
- Only part of the [parameters](#parameters) previously supported are available.
69
69
- The JSON Form Editor is not implemented.
70
-
- Shebang URL support for operations is missing.
71
70
- Support for `collectionFormat` is partial.
72
71
- l10n (translations) is not implemented.
73
72
- Relative path support for external files is not implemented.
@@ -82,17 +81,17 @@ To use swagger-ui's bundles, you should take a look at the [source of swagger-ui
82
81
83
82
```javascript
84
83
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
-
})
84
+
url:"http://petstore.swagger.io/v2/swagger.json",
85
+
dom_id:'#swagger-ui',
86
+
presets: [
87
+
SwaggerUIBundle.presets.apis,
88
+
SwaggerUIStandalonePreset
89
+
],
90
+
plugins: [
91
+
SwaggerUIBundle.plugins.DownloadUrl
92
+
],
93
+
layout:"StandaloneLayout"
94
+
})
96
95
```
97
96
98
97
#### OAuth2 configuration
@@ -137,13 +136,16 @@ spec | A JSON object describing the OpenAPI Specification. When used, the `url`
137
136
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
137
dom_id | The id of a dom element inside which SwaggerUi will put the user interface for swagger.
139
138
oauth2RedirectUrl | OAuth redirect URL
139
+
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
140
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
141
configUrl | Configs URL
142
142
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
143
modelPropertyMacro | MUST be a function. Function to set default values to each property in model. Accepts one argument modelPropertyMacro(property), property is immutable
144
144
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
145
displayOperationId | Controls the display of operationId in operations list. The default is `false`.
146
146
displayRequestDuration | Controls the display of the request duration (in milliseconds) for `Try it out` requests. The default is `false`.
147
+
maxDisplayedTags | If set, limits the number of tagged operations displayed to at most this many. The default is to show all operations.
148
+
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.
Swagger-UI allows you to deeply link into tags and operations within a spec. When Swagger-UI is provided a URL fragment at runtime, it will automatically expand and scroll to a specified tag or operation.
4
+
5
+
## Usage
6
+
7
+
👉🏼 Add `deepLinking: true` to your Swagger-UI configuration to enable this functionality.
8
+
9
+
When you expand a tag or operation, Swagger-UI will automatically update its URL fragment with a deep link to the item.
10
+
Conversely, when you collapse a tag or operation, Swagger-UI will clear the URL fragment.
11
+
12
+
You can also right-click a tag name or operation path in order to copy a link to that tag or operation.
13
+
14
+
#### Fragment format
15
+
16
+
The fragment is formatted in one of two ways:
17
+
18
+
-`#/{tagName}`, to trigger the focus of a specific tag
19
+
-`#/{tagName}/{operationId}`, to trigger the focus of a specific operation within a tag
20
+
21
+
`operationId` is the explicit operationId provided in the spec, if one exists.
22
+
Otherwise, Swagger-UI generates an implicit operationId by combining the operation's path and method, and escaping non-alphanumeric characters.
23
+
24
+
## FAQ
25
+
26
+
> I'm using Swagger-UI in an application that needs control of the URL fragment. How do I disable deep-linking?
27
+
28
+
This functionality is disabled by default, but you can pass `deepLinking: false` into Swagger-UI as a configuration item to be sure.
29
+
30
+
> Can I link to multiple tags or operations?
31
+
32
+
No, this is not supported.
33
+
34
+
> Can I collapse everything except the operation or tag I'm linking to?
35
+
36
+
Sure - use `docExpansion: none` to collapse all tags and operations. Your deep link will take precedence over the setting, so only the tag or operation you've specified will be expanded.
0 commit comments