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
+40-9Lines changed: 40 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,9 @@ Swagger UI Version | Release Date | Swagger Spec compatibility | Notes | Status
30
30
### Download
31
31
You can use the swagger-ui code AS-IS! No need to build or recompile--just clone this repo and use the pre-built files in the `dist` folder. If you like swagger-ui as-is, stop here.
32
32
33
+
##### Browser support
34
+
Swagger UI works in all evergreen desktop browsers (Chrome, Safari, Firefox). Internet Explorer support is version 8 (IE8) and above.
35
+
33
36
### Build
34
37
You can rebuild swagger-ui on your own to tweak it or just so you can say you did. To do so, follow these steps:
35
38
@@ -57,24 +60,24 @@ Once you open the Swagger UI, it will load the [Swagger Petstore](http://petstor
57
60
You may choose to customize Swagger UI for your organization. Here is an overview of whats in its various directories:
58
61
59
62
- dist: Contains a distribution which you can deploy on a server or load from your local machine.
63
+
- dist/lang: The swagger localisation
60
64
- lib: Contains javascript dependencies which swagger-ui depends on
61
65
- node_modules: Contains node modules which swagger-ui uses for its development.
62
66
- src
63
-
- src/main/coffeescript: main code in CoffeeScript
64
67
- src/main/templates: [handlebars](http://handlebarsjs.com/) templates used to render swagger-ui
65
68
- src/main/html: the html files, some images and css
66
-
- src/main/javascript: some legacy javascript referenced by CoffeeScript code
69
+
- src/main/javascript: main code
67
70
68
71
### SwaggerUi
69
72
To use swagger-ui 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 and call load() on it as below:
70
73
71
74
```javascript
72
-
window.swaggerUi=newSwaggerUi({
75
+
varswaggerUi =newSwaggerUi({
73
76
url:"http://petstore.swagger.io/v2/swagger.json",
74
77
dom_id:"swagger-ui-container"
75
78
});
76
79
77
-
window.swaggerUi.load();
80
+
swaggerUi.load();
78
81
```
79
82
80
83
##### Parameters
@@ -87,11 +90,13 @@ validatorUrl | By default, Swagger-UI attempts to validate specs against swagger
87
90
dom_id | The id of a dom element inside which SwaggerUi will put the user interface for swagger.
88
91
booleanValues | SwaggerUI renders boolean data types as a dropdown. By default it provides a 'true' and 'false' string as the possible choices. You can use this parameter to change the values in dropdown to be something else, for example 0 and 1 by setting booleanValues to new Array(0, 1).
89
92
docExpansion | Controls how the API listing is displayed. It can be set to 'none' (default), 'list' (shows operations for each resource), or 'full' (fully expanded: shows operations and their details).
90
-
sorter | Apply a sort to the API list. It can be 'alpha' (sort paths alphanumerically) or 'method' (sort operations by HTTP method). Default is the order returned by the server unchanged.
93
+
apisSorter | Apply a sort to the API/tags list. It can be 'alpha' (sort by name) or a function (see Array.prototype.sort() to know how sort function works). Default is the order returned by the server unchanged.
94
+
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.
91
95
onComplete | This is a callback function parameter which can be passed to be notified of when SwaggerUI has completed rendering successfully.
92
96
onFailure | This is a callback function parameter which can be passed to be notified of when SwaggerUI encountered a failure was unable to render.
93
97
highlightSizeThreshold | Any size response below this threshold will be highlighted syntactically, attempting to highlight large responses can lead to browser hangs, not including a threshold will default to highlight all returned responses.
94
98
supportedSubmitMethods | An array of of the HTTP operations that will have the 'Try it out!` option. An empty array disables all operations. This does not filter the operations from the display.
99
+
oauth2RedirectUrl | OAuth redirect URL
95
100
96
101
* All other parameters are explained in greater detail below
97
102
@@ -104,11 +109,11 @@ swagger-ui supports invocation of all HTTP methods APIs including GET, PUT, POST
104
109
Header params are supported through a pluggable mechanism in [swagger-js](https://github.com/swagger-api/swagger-js). You can see the [index.html](https://github.com/swagger-api/swagger-ui/blob/master/dist/index.html) for a sample of how to dynamically set headers:
105
110
106
111
```js
107
-
// add a new ApiKeyAuthorization when the api-key changes in the ui.
112
+
// add a new SwaggerClient.ApiKeyAuthorization when the api-key changes in the ui.
or <anyHtmlTagdata-sw-translatevalue='new sentence'/>
152
+
```
153
+
.
154
+
155
+
At this moment only inner html, title-attribute and value-attribute are going to be translated.
156
+
127
157
## CORS Support
128
158
129
159
CORS is a technique to prevent websites from doing bad things with your personal data. Most browsers + javascript toolkits not only support CORS but enforce it, which has implications for your API server which supports Swagger.
@@ -191,7 +221,8 @@ Create your own fork of [swagger-api/swagger-ui](https://github.com/swagger-api/
191
221
192
222
To share your changes, [submit a pull request](https://github.com/swagger-api/swagger-ui/pull/new/master).
193
223
194
-
Since the javascript files are compiled from coffeescript, please submit changes in the *.coffee files! We have to reject changes only in the .js files as they will be lost on each build of the ui.
224
+
## Change Log
225
+
Plsee see [releases](https://github.com/swagger-api/swagger-ui/releases) for change log.
0 commit comments