@fastify/swagger-ui
Advanced tools
@@ -12,3 +12,3 @@ 'use strict' | ||
| fastify.reqister(require('../index')) | ||
| fastify.register(require('../index')) | ||
@@ -15,0 +15,0 @@ fastify.listen({ port: 3000 }, (err) => { |
+5
-15
@@ -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 @@ |
+1
-1
| { | ||
| "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", |
+1
-0
@@ -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: |
+36
-0
@@ -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') | ||
| }) |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
4450983
0.02%9501
0.2%124
0.81%25
-3.85%