@fastify/swagger-ui
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -12,3 +12,3 @@ 'use strict' | ||
fastify.reqister(require('../index')) | ||
fastify.register(require('../index')) | ||
@@ -15,0 +15,0 @@ fastify.listen({ port: 3000 }, (err) => { |
20
index.js
@@ -8,18 +8,8 @@ 'use strict' | ||
const baseDir = opts.baseDir | ||
const prefix = opts.routePrefix || '/documentation' | ||
const uiConfig = opts.uiConfig || {} | ||
const initOAuth = opts.initOAuth || {} | ||
const staticCSP = opts.staticCSP | ||
const transformStaticCSP = opts.transformStaticCSP | ||
const hooks = opts.uiHooks | ||
fastify.register(require('./lib/routes'), { | ||
baseDir, | ||
prefix, | ||
uiConfig, | ||
initOAuth, | ||
staticCSP, | ||
transformStaticCSP, | ||
hooks | ||
prefix: opts.routePrefix || '/documentation', | ||
uiConfig: opts.uiConfig || {}, | ||
initOAuth: opts.initOAuth || {}, | ||
hooks: opts.uiHooks, | ||
...opts | ||
}) | ||
@@ -26,0 +16,0 @@ |
{ | ||
"name": "@fastify/swagger-ui", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Serve Swagger-ui for Fastify", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -109,2 +109,3 @@ # @fastify/swagger-ui | ||
| uiHooks | {} | Additional hooks for the documentation's routes. You can provide the `onRequest` and `preHandler` hooks with the same [route's options](https://www.fastify.io/docs/latest/Routes/#options) interface.| | ||
| logLevel | info | Allow to define route log level.| | ||
@@ -111,0 +112,0 @@ The plugin will expose the documentation with the following APIs: |
@@ -533,1 +533,37 @@ 'use strict' | ||
}) | ||
test('should return silent log level of route /documentation', async (t) => { | ||
const fastify = Fastify() | ||
fastify.addHook('onRoute', function (route) { | ||
t.equal(route.logLevel, 'silent') | ||
}) | ||
await fastify.register(fastifySwagger, swaggerOption) | ||
await fastify.register(fastifySwaggerUi, { logLevel: 'silent' }) | ||
const res = await fastify.inject({ | ||
method: 'GET', | ||
url: '/documentation/' | ||
}) | ||
t.equal(res.statusCode, 302) | ||
t.equal(res.headers.location, './static/index.html') | ||
}) | ||
test('should return empty log level of route /documentation', async (t) => { | ||
const fastify = Fastify() | ||
fastify.addHook('onRoute', function (route) { | ||
t.equal(route.logLevel, '') | ||
}) | ||
await fastify.register(fastifySwagger, swaggerOption) | ||
await fastify.register(fastifySwaggerUi) | ||
const res = await fastify.inject({ | ||
method: 'GET', | ||
url: '/documentation/' | ||
}) | ||
t.equal(res.statusCode, 302) | ||
t.equal(res.headers.location, './static/index.html') | ||
}) |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
4450983
9501
124
2