fastify-swagger
Advanced tools
Comparing version 0.12.0 to 0.13.0
@@ -29,2 +29,4 @@ 'use strict' | ||
const security = opts.swagger.security || null | ||
const tags = opts.swagger.tags || null | ||
const externalDocs = opts.swagger.externalDocs || null | ||
@@ -81,2 +83,8 @@ if (opts.exposeRoute === true) { | ||
} | ||
if (tags) { | ||
swaggerObject.tags = tags | ||
} | ||
if (externalDocs) { | ||
swaggerObject.externalDocs = externalDocs | ||
} | ||
@@ -83,0 +91,0 @@ swaggerObject.paths = {} |
{ | ||
"name": "fastify-swagger", | ||
"version": "0.12.0", | ||
"version": "0.13.0", | ||
"description": "Generate Swagger files automatically for Fastify.", | ||
@@ -32,14 +32,14 @@ "main": "index.js", | ||
"devDependencies": { | ||
"fastify": "^1.5.0", | ||
"fs-extra": "^6.0.0", | ||
"fastify": "^1.9.0", | ||
"fs-extra": "^7.0.0", | ||
"pre-commit": "^1.2.2", | ||
"standard": "^11.0.0", | ||
"swagger-parser": "^5.0.0", | ||
"swagger-ui-dist": "3.16.0", | ||
"swagger-parser": "^5.0.1", | ||
"swagger-ui-dist": "3.17.3", | ||
"tap": "^12.0.0" | ||
}, | ||
"dependencies": { | ||
"fastify-plugin": "^1.0.0", | ||
"fastify-plugin": "^1.2.0", | ||
"fastify-static": "^0.12.0", | ||
"js-yaml": "^3.11.0" | ||
"js-yaml": "^3.12.0" | ||
}, | ||
@@ -46,0 +46,0 @@ "standard": { |
@@ -23,2 +23,3 @@ # fastify-swagger | ||
fastify.register(require('fastify-swagger'), { | ||
routePrefix: '/documentation', | ||
swagger: { | ||
@@ -30,3 +31,6 @@ info: { | ||
}, | ||
routePrefix: '/documentation', | ||
externalDocs: { | ||
url: 'https://swagger.io', | ||
description: 'Find more info here' | ||
}, | ||
host: 'localhost', | ||
@@ -36,2 +40,6 @@ schemes: ['http'], | ||
produces: ['application/json'], | ||
tags: [ | ||
{ name: 'user', description: 'User related end-points' }, | ||
{ name: 'code', description: 'Code related end-points' } | ||
], | ||
securityDefinitions: { | ||
@@ -113,2 +121,3 @@ apiKey: { | ||
}, | ||
externalDocs: Object, | ||
host: String, | ||
@@ -118,2 +127,3 @@ schemes: [ String ], | ||
produces: [ String ], | ||
tags: [ Object ], | ||
securityDefinitions: Object | ||
@@ -120,0 +130,0 @@ } |
@@ -21,2 +21,9 @@ 'use strict' | ||
produces: ['application/json'], | ||
tags: [ | ||
{name: 'tag'} | ||
], | ||
externalDocs: { | ||
description: 'Find more info here', | ||
url: 'https://swagger.io' | ||
}, | ||
securityDefinitions: { | ||
@@ -327,2 +334,34 @@ apiKey: { | ||
test('fastify.swagger tags', t => { | ||
t.plan(2) | ||
const fastify = Fastify() | ||
fastify.register(fastifySwagger, swaggerInfo) | ||
fastify.get('/', () => {}) | ||
fastify.ready(err => { | ||
t.error(err) | ||
const swaggerObject = fastify.swagger() | ||
t.equal(swaggerObject.tags, swaggerInfo.swagger.tags) | ||
}) | ||
}) | ||
test('fastify.swagger externalDocs', t => { | ||
t.plan(2) | ||
const fastify = Fastify() | ||
fastify.register(fastifySwagger, swaggerInfo) | ||
fastify.get('/', () => {}) | ||
fastify.ready(err => { | ||
t.error(err) | ||
const swaggerObject = fastify.swagger() | ||
t.equal(swaggerObject.externalDocs, swaggerInfo.swagger.externalDocs) | ||
}) | ||
}) | ||
test('hide support', t => { | ||
@@ -329,0 +368,0 @@ t.plan(2) |
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
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
11495046
11884
212
Updatedfastify-plugin@^1.2.0
Updatedjs-yaml@^3.12.0