@fastify/swagger-ui
Advanced tools
Comparing version 1.7.0 to 1.8.0
@@ -9,3 +9,3 @@ 'use strict' | ||
<meta charset="UTF-8"> | ||
<title>Swagger UI</title> | ||
<title>${opts.theme?.title || 'Swagger UI'}</title> | ||
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" /> | ||
@@ -12,0 +12,0 @@ <link rel="stylesheet" type="text/css" href="./index.css" /> |
{ | ||
"name": "@fastify/swagger-ui", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "Serve Swagger-ui for Fastify", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -212,2 +212,3 @@ # @fastify/swagger-ui | ||
theme: { | ||
title: 'My custom title', | ||
js: [ | ||
@@ -214,0 +215,0 @@ { filename: 'special.js', content: 'alert("client javascript")' } |
@@ -218,1 +218,28 @@ 'use strict' | ||
}) | ||
test('swagger route returns additional theme - only title', async (t) => { | ||
const config = { | ||
mode: 'static', | ||
specification: { | ||
path: './examples/example-static-specification.yaml' | ||
} | ||
} | ||
t.plan(3) | ||
const fastify = Fastify() | ||
await fastify.register(fastifySwagger, config) | ||
await fastify.register(fastifySwaggerUi, { | ||
theme: { | ||
title: 'My custom title' | ||
} | ||
}) | ||
const res = await fastify.inject({ | ||
method: 'GET', | ||
url: '/documentation/static/index.html' | ||
}) | ||
t.equal(typeof res.payload, 'string') | ||
t.match(res.payload, /<title>My custom title<\/title>/) | ||
t.equal(res.headers['content-type'], 'text/html; charset=utf-8') | ||
}) |
@@ -63,5 +63,6 @@ import { FastifyPluginCallback, FastifyReply, FastifyRequest, onRequestHookHandler, preHandlerHookHandler } from 'fastify'; | ||
type FastifySwaggerUiTheme = { | ||
title?: string; | ||
css?: { filename: string; content: string; }[]; | ||
js?: { filename: string; content: string; }[]; | ||
favicon: { filename: string; rel: string; type: string; sizes: string; content: string | Buffer; }[]; | ||
favicon?: { filename: string; rel: string; type: string; sizes: string; content: string | Buffer; }[]; | ||
} | ||
@@ -68,0 +69,0 @@ |
@@ -151,2 +151,6 @@ import fastify, { FastifyReply, FastifyRequest } from 'fastify'; | ||
app.register(fastifySwaggerUi, { | ||
theme: {} | ||
}) | ||
app.register(fastifySwaggerUi, { | ||
theme: { | ||
@@ -164,1 +168,7 @@ favicon: [ | ||
}) | ||
app.register(fastifySwaggerUi, { | ||
theme: { | ||
title: 'My Awesome Swagger Title' | ||
}, | ||
}) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
Network access
Supply chain riskThis module accesses the network.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
308
4533113
10531
2