fastify-swagger
Advanced tools
Comparing version 0.3.2 to 0.4.0
@@ -104,2 +104,6 @@ 'use strict' | ||
if (schema.consumes) { | ||
swaggerMethod.consumes = schema.consumes | ||
} | ||
if (schema.querystring) { | ||
@@ -106,0 +110,0 @@ getQueryParams(parameters, schema.querystring) |
{ | ||
"name": "fastify-swagger", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"description": "Generate Swagger files automatically for Fastify.", | ||
@@ -26,7 +26,7 @@ "main": "index.js", | ||
"standard": "^10.0.3", | ||
"swagger-parser": "^4.0.1", | ||
"tap": "^11.0.0" | ||
"swagger-parser": "^4.0.2", | ||
"tap": "^11.1.0" | ||
}, | ||
"dependencies": { | ||
"fastify-plugin": "^0.2.1", | ||
"fastify-plugin": "^0.2.2", | ||
"js-yaml": "^3.10.0" | ||
@@ -33,0 +33,0 @@ }, |
@@ -346,1 +346,37 @@ 'use strict' | ||
}) | ||
test('route meta info', t => { | ||
t.plan(6) | ||
const fastify = Fastify() | ||
fastify.register(fastifySwagger, swaggerInfo) | ||
const opts = { | ||
schema: { | ||
summary: 'Route summary', | ||
tags: ['tag'], | ||
description: 'Route description', | ||
consumes: ['application/x-www-form-urlencoded'] | ||
} | ||
} | ||
fastify.get('/', opts, () => {}) | ||
fastify.ready(err => { | ||
t.error(err) | ||
const swaggerObject = fastify.swagger() | ||
Swagger.validate(swaggerObject) | ||
.then(function (api) { | ||
const definedPath = api.paths['/'].get | ||
t.ok(definedPath) | ||
t.equal(opts.schema.summary, definedPath.summary) | ||
t.same(opts.schema.tags, definedPath.tags) | ||
t.equal(opts.schema.description, definedPath.description) | ||
t.same(opts.schema.consumes, definedPath.consumes) | ||
}) | ||
.catch(function (err) { | ||
t.fail(err) | ||
}) | ||
}) | ||
}) |
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
17812162
9910
Updatedfastify-plugin@^0.2.2