swagger-ui-express
Advanced tools
Comparing version 4.0.4 to 4.0.5
{ | ||
"name": "swagger-ui-express", | ||
"version": "4.0.4", | ||
"version": "4.0.5", | ||
"description": "Swagger UI Express", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -87,2 +87,4 @@ # Swagger UI Express | ||
For all the available options, refer to [Swagger UI Configuration](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md) | ||
### Custom CSS styles | ||
@@ -143,3 +145,3 @@ | ||
To load your swagger from a url instead of injecting the document, pass `null` as the first parameter, and pass the relative or absolute URL as the 'swaggerUrl' property of the options to the setup function. | ||
To load your swagger from a url instead of injecting the document, pass `null` as the first parameter, and pass the relative or absolute URL as the 'url' property to 'swaggerOptions' in the setup function. | ||
@@ -152,3 +154,5 @@ ```javascript | ||
var options = { | ||
swaggerUrl: 'http://petstore.swagger.io/v2/swagger.json' | ||
swaggerOptions: { | ||
url: 'http://petstore.swagger.io/v2/swagger.json' | ||
} | ||
} | ||
@@ -159,2 +163,31 @@ | ||
To load multiple swagger documents from urls as a dropdown in the explorer bar, pass an array of object with `name` and `url` to 'urls' property to 'swaggerOptions' in the setup function. | ||
```javascript | ||
const express = require('express'); | ||
const app = express(); | ||
const swaggerUi = require('swagger-ui-express'); | ||
var options = { | ||
explorer: true, | ||
swaggerOptions: { | ||
urls: [ | ||
{ | ||
url: 'http://petstore.swagger.io/v2/swagger.json', | ||
name: 'Spec1' | ||
}, | ||
{ | ||
url: 'http://petstore.swagger.io/v2/swagger.json', | ||
name: 'Spec2' | ||
} | ||
] | ||
} | ||
} | ||
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(null, options)); | ||
``` | ||
Make sure 'explorer' option is set to 'true' in your setup options for the dropdown to be visible. | ||
### Load swagger from yaml file | ||
@@ -161,0 +194,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16929
215