Browse Source

Complying with request for changes

bubble
Raphaël MARQUES 7 years ago
parent
commit
8ce2b309d8
3 changed files with 34 additions and 36 deletions
  1. +12
    -15
      README.md
  2. +20
    -21
      dev-helpers/index.html
  3. +2
    -0
      src/core/index.js

+ 12
- 15
README.md View File

@@ -82,20 +82,17 @@ To use swagger-ui's bundles, you should take a look at the [source of swagger-ui

```javascript
const ui = SwaggerUIBundle({
url: "http://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout",
docExpansion: "none",
apisSorter: "alpha",
operationsSorter: "method"
})
url: "http://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
```

#### OAuth2 configuration
@@ -140,7 +137,7 @@ spec | A JSON object describing the OpenAPI Specification. When used, the `url`
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.
dom_id | The id of a dom element inside which SwaggerUi will put the user interface for swagger.
oauth2RedirectUrl | OAuth redirect URL
apisSorter | 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() to know how sort function works). Default is the order returned by the server unchanged.
apisSorter | 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() to know how sort function works). Default is the order detemrined by Swagger-UI.
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.
configUrl | Configs URL
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


+ 20
- 21
dev-helpers/index.html View File

@@ -4,26 +4,26 @@
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link
href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./swagger-ui.css">
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32"/>
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16"/>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html {
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}

*,
*:before,
*:after {
*:after
{
box-sizing: inherit;
}

body {
margin: 0;
margin:0;
background: #fafafa;
}
</style>
@@ -67,14 +67,14 @@

<div id="swagger-ui"></div>

<script src="./swagger-ui-bundle.js"></script>
<script src="./swagger-ui-standalone-preset.js"></script>
<script src="./swagger-ui-bundle.js"> </script>
<script src="./swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = () => {
window[ "SwaggerUIBundle" ] = window[ "swagger-ui-bundle" ];
window[ "SwaggerUIStandalonePreset" ] = window[ "swagger-ui-standalone-preset" ];
window.onload = function() {
window["SwaggerUIBundle"] = window["swagger-ui-bundle"]
window["SwaggerUIStandalonePreset"] = window["swagger-ui-standalone-preset"]
// Build a system
const ui = window.ui = SwaggerUIBundle({
const ui = SwaggerUIBundle({
url: "http://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
presets: [
@@ -84,11 +84,10 @@
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout",
docExpansion: "none",
apisSorter: "alpha",
operationsSorter: "method"
});
layout: "StandaloneLayout"
})

window.ui = ui

ui.initOAuth({
clientId: "your-client-id",
@@ -98,7 +97,7 @@
scopeSeparator: " ",
additionalQueryStringParams: {}
})
};
}
</script>
</body>



+ 2
- 0
src/core/index.js View File

@@ -26,6 +26,8 @@ module.exports = function SwaggerUI(opts) {
urls: null,
layout: "BaseLayout",
docExpansion: "list",
apisSorter: "alpha",
operationsSorter: "method",
validatorUrl: "https://online.swagger.io/validator",
configs: {},
custom: {},


Loading…
Cancel
Save