Socket
Socket
Sign inDemoInstall

@fastify/swagger-ui

Package Overview
Dependencies
Maintainers
17
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/swagger-ui - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

2

examples/static-yaml-file.js

@@ -12,3 +12,3 @@ 'use strict'

fastify.reqister(require('../index'))
fastify.register(require('../index'))

@@ -15,0 +15,0 @@ fastify.listen({ port: 3000 }, (err) => {

@@ -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')
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc