Socket
Socket
Sign inDemoInstall

@fastify/swagger-ui

Package Overview
Dependencies
Maintainers
16
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.7.0 to 1.8.0

2

lib/index-html.js

@@ -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

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