Socket
Socket
Sign inDemoInstall

@fastify/swagger

Package Overview
Dependencies
Maintainers
20
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/swagger - npm Package Compare versions

Comparing version 8.10.0 to 8.10.1

4

lib/mode/static.js
'use strict'
const path = require('path')
const fs = require('fs')
const path = require('node:path')
const fs = require('node:fs')
const yaml = require('yaml')

@@ -6,0 +6,0 @@

@@ -9,2 +9,3 @@ 'use strict'

const sharedSchemasMap = new Map()
let hookRun = false

@@ -55,2 +56,3 @@ fastify.addHook('onRoute', (routeOptions) => {

fastify.addHook('onReady', (done) => {
hookRun = true
const allSchemas = fastify.getSchemas()

@@ -67,2 +69,5 @@ for (const schemaId of Object.keys(allSchemas)) {

Ref () {
if (hookRun === false) {
throw new Error('.swagger() must be called after .ready()')
}
const externalSchemas = cloner(Array.from(sharedSchemasMap.values()))

@@ -69,0 +74,0 @@ return Ref(Object.assign(

'use strict'
const fs = require('fs')
const path = require('path')
const fs = require('node:fs')
const path = require('node:path')

@@ -6,0 +6,0 @@ function readPackageJson () {

{
"name": "@fastify/swagger",
"version": "8.10.0",
"version": "8.10.1",
"description": "Serve Swagger/OpenAPI documentation for Fastify, supporting dynamic generation",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -16,1 +16,21 @@ 'use strict'

})
test('fastify.swagger should throw if called before ready', async (t) => {
t.plan(1)
const fastify = Fastify()
await fastify.register(fastifySwagger)
t.throws(fastify.swagger.bind(fastify))
})
test('fastify.swagger should throw if called before ready (openapi)', async (t) => {
t.plan(1)
const fastify = Fastify()
await fastify.register(fastifySwagger, {
openapi: {}
})
t.throws(fastify.swagger.bind(fastify))
})
'use strict'
const path = require('path')
const path = require('node:path')
const { test } = require('tap')

@@ -9,4 +9,4 @@ const Fastify = require('fastify')

const Swagger = require('@apidevtools/swagger-parser')
const readFileSync = require('fs').readFileSync
const resolve = require('path').resolve
const readFileSync = require('node:fs').readFileSync
const resolve = require('node:path').resolve
const yaml = require('yaml')

@@ -13,0 +13,0 @@

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