Socket
Socket
Sign inDemoInstall

@fastify/swagger

Package Overview
Dependencies
Maintainers
19
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 7.5.0 to 7.5.1

11

lib/util/common.js

@@ -190,6 +190,9 @@ 'use strict'

// $ref is in the format: #/definitions/<resolved definition>/<optional fragment>
const localRef = jsonSchema.$ref.split('/')[2]
if (externalSchemas[localRef]) return resolveLocalRef(externalSchemas[localRef], externalSchemas)
// $ref is in the format: #/components/schemas/<resolved definition>
return resolveLocalRef(externalSchemas[jsonSchema.$ref.split('/')[3]], externalSchemas)
if (jsonSchema.$ref) {
const localRef = jsonSchema.$ref.split('/')[2]
if (externalSchemas[localRef]) return resolveLocalRef(externalSchemas[localRef], externalSchemas)
// $ref is in the format: #/components/schemas/<resolved definition>
return resolveLocalRef(externalSchemas[jsonSchema.$ref.split('/')[3]], externalSchemas)
}
return jsonSchema
}

@@ -196,0 +199,0 @@

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

@@ -16,3 +16,3 @@ "main": "index.js",

"typescript": "tsd",
"unit": "tap -J \"test/**/*.js\"",
"unit": "tap",
"unit:report": "npm run unit -- --coverage-report=html",

@@ -81,3 +81,7 @@ "unit:verbose": "npm run unit -- -Rspec"

"access": "public"
}
},
"pre-commit": [
"lint",
"test"
]
}

@@ -1,1 +0,1 @@

{"script":["'sha256-4IiDsMH+GkJlxivIDNfi6qk0O5HPtzyvNwVT3Wt8TIw='"],"style":[]}
{"script":["'sha256-g6TK8Crx7YtGVUN10j0q8wD3cvwyzlvBMzQx4UjBPg4='"],"style":[]}

@@ -241,1 +241,45 @@ 'use strict'

})
test('uses examples if has property required in body', async (t) => {
t.plan(3)
const fastify = Fastify()
await fastify.register(fastifySwagger, openapiOption)
fastify.get('/', {
schema: {
query: {
type: 'object',
oneOf: [
{
properties: {
bar: { type: 'number' }
}
},
{
properties: {
foo: { type: 'string' }
}
}
]
},
response: {
200: {
type: 'object',
properties: {
result: { type: 'string' }
}
}
}
}
}, (req, reply) => ({ result: 'OK' }))
await fastify.ready()
const openapiObject = fastify.swagger()
const schema = openapiObject.paths['/'].get
t.ok(schema)
t.ok(schema.parameters)
t.same(schema.parameters[0].in, 'query')
})

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

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