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
+25-5Lines changed: 25 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,16 +6,23 @@
6
6
7
7
**This is the new version of swagger-ui, 3.x. Want to learn more? Check out our [FAQ](http://swagger.io/new-ui-faq/).**
8
8
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
+
9
11
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.
10
12
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
+
11
18
For the older version of swagger-ui, refer to the [*2.x branch*](https://github.com/swagger-api/swagger-ui/tree/2.x).
12
19
13
20
## Compatibility
14
21
The OpenAPI Specification has undergone 4 revisions since initial creation in 2010. Compatibility between swagger-ui and the OpenAPI Specification is as follows:
15
22
16
23
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
@@ -35,6 +42,12 @@ docker run -p 80:8080 swaggerapi/swagger-ui
35
42
36
43
Will start nginx with swagger-ui on port 80.
37
44
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
+
38
51
##### Prerequisites
39
52
- Node 6.x
40
53
- NPM 3.x
@@ -59,6 +72,11 @@ To help with the migration, here are the currently known issues with 3.X. This l
59
72
- l10n (translations) is not implemented.
60
73
- Relative path support for external files is not implemented.
61
74
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
+
62
80
### SwaggerUIBundle
63
81
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:
64
82
@@ -83,11 +101,11 @@ default `client_id` and `client_secret`, `realm`, an application name `appName`,
83
101
84
102
Config Name | Description
85
103
--- | ---
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
88
106
realm | realm query parameter (for oauth1) added to `authorizationUrl` and `tokenUrl` . MUST be a string
89
107
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
91
109
additionalQueryStringParams | Additional query parameters added to `authorizationUrl` and `tokenUrl`. MUST be an object
92
110
93
111
```
@@ -119,6 +137,8 @@ operationsSorter | Apply a sort to the operation list of each API. It can be 'al
119
137
configUrl | Configs URL
120
138
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
121
139
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`.
122
142
123
143
### Plugins
124
144
@@ -138,7 +158,7 @@ let preset = [
138
158
```
139
159
140
160
#### 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.
142
162
There are three options of passing config:
143
163
- 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
144
164
- add a config `configUrl` with URL to SwaggerUIBundle
0 commit comments