Update docs
This commit is contained in:
18
README.md
18
README.md
@@ -73,12 +73,12 @@ You may choose to customize Swagger UI for your organization. Here is an overvie
|
||||
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:
|
||||
|
||||
```javascript
|
||||
window.swaggerUi = new SwaggerUi({
|
||||
var swaggerUi = new SwaggerUi({
|
||||
url:"http://petstore.swagger.io/v2/swagger.json",
|
||||
dom_id:"swagger-ui-container"
|
||||
});
|
||||
|
||||
window.swaggerUi.load();
|
||||
swaggerUi.load();
|
||||
```
|
||||
|
||||
##### Parameters
|
||||
@@ -108,11 +108,11 @@ swagger-ui supports invocation of all HTTP methods APIs including GET, PUT, POST
|
||||
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:
|
||||
|
||||
```js
|
||||
// add a new ApiKeyAuthorization when the api-key changes in the ui.
|
||||
// add a new SwaggerClient.ApiKeyAuthorization when the api-key changes in the ui.
|
||||
$('#input_apiKey').change(function() {
|
||||
var key = $('#input_apiKey')[0].value;
|
||||
if(key && key.trim() != "") {
|
||||
window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "header"));
|
||||
swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorization("api_key", key, "header"));
|
||||
}
|
||||
})
|
||||
```
|
||||
@@ -123,15 +123,15 @@ This will add header `api_key` with value `key` on every call to the server. Yo
|
||||
If you have some header parameters which you need to send with every request, use the headers as below:
|
||||
|
||||
```js
|
||||
window.authorizations.add("key", new ApiKeyAuthorization("Authorization", "XXXX", "header"));
|
||||
swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorization("Authorization", "XXXX", "header"));
|
||||
```
|
||||
|
||||
Note! You can pass multiple header params on a single request, just use unique names for them (`key` is used in the above example).
|
||||
|
||||
### Localisation and translation
|
||||
The localisation files are in the dist/lang directory.
|
||||
### Localization and translation
|
||||
The localization files are in the dist/lang directory.
|
||||
|
||||
To enable translation you should append next two lines in your swagger's index.html (or another entry point you use)
|
||||
To enable translation you should append next two lines in your Swagger's index.html (or another entry point you use)
|
||||
```html
|
||||
<script src='lang/translator.js' type='text/javascript'></script>
|
||||
<script src='lang/en.js' type='text/javascript'></script>
|
||||
@@ -220,8 +220,6 @@ Create your own fork of [swagger-api/swagger-ui](https://github.com/swagger-api/
|
||||
|
||||
To share your changes, [submit a pull request](https://github.com/swagger-api/swagger-ui/pull/new/master).
|
||||
|
||||
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.
|
||||
|
||||
## Change Log
|
||||
Plsee see [releases](https://github.com/swagger-api/swagger-ui/releases) for change log.
|
||||
|
||||
|
||||
@@ -67,9 +67,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
$('#input_apiKey').change(function() {
|
||||
addApiKeyAuthorization();
|
||||
});
|
||||
$('#input_apiKey').change(addApiKeyAuthorization);
|
||||
|
||||
// if you have an apiKey you would like to pre-populate on the page for demonstration purposes...
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user