fastify-swagger
Advanced tools
Comparing version 0.10.2 to 0.11.0
@@ -25,2 +25,3 @@ 'use strict' | ||
const produces = opts.swagger.produces || null | ||
const definitions = opts.swagger.definitions || null | ||
const basePath = opts.swagger.basePath || null | ||
@@ -73,2 +74,3 @@ const securityDefinitions = opts.swagger.securityDefinitions || null | ||
if (produces) swaggerObject.produces = produces | ||
if (definitions) swaggerObject.definitions = definitions | ||
if (securityDefinitions) { | ||
@@ -75,0 +77,0 @@ swaggerObject.securityDefinitions = securityDefinitions |
{ | ||
"name": "fastify-swagger", | ||
"version": "0.10.2", | ||
"version": "0.11.0", | ||
"description": "Generate Swagger files automatically for Fastify.", | ||
@@ -20,2 +20,8 @@ "main": "index.js", | ||
"author": "Tomas Della Vedova - @delvedor (http://delved.org)", | ||
"contributors": [ | ||
{ | ||
"name": "Matteo Collina", | ||
"email": "hello@matteocollina.com" | ||
} | ||
], | ||
"license": "MIT", | ||
@@ -27,3 +33,3 @@ "bugs": { | ||
"devDependencies": { | ||
"fastify": "^1.3.1", | ||
"fastify": "^1.4.0", | ||
"fs-extra": "^6.0.0", | ||
@@ -33,4 +39,4 @@ "pre-commit": "^1.2.2", | ||
"swagger-parser": "^4.1.0", | ||
"swagger-ui-dist": "3.14.0", | ||
"tap": "^11.1.4" | ||
"swagger-ui-dist": "3.15.0", | ||
"tap": "^12.0.0" | ||
}, | ||
@@ -37,0 +43,0 @@ "dependencies": { |
@@ -282,3 +282,2 @@ 'use strict' | ||
const swaggerObject = fastify.swagger() | ||
t.equal(swaggerObject.info, swaggerInfo.swagger.info) | ||
@@ -292,2 +291,38 @@ t.equal(swaggerObject.host, swaggerInfo.swagger.host) | ||
test('fastify.swagger definitions', t => { | ||
t.plan(2) | ||
const fastify = Fastify() | ||
fastify.register(fastifySwagger, swaggerInfo) | ||
const opts = { | ||
schema: { | ||
definitions: { | ||
'ExampleModel': { | ||
'type': 'object', | ||
'properties': { | ||
'id': { | ||
'type': 'integer', | ||
'description': 'Some id' | ||
}, | ||
'name': { | ||
'type': 'string', | ||
'description': 'Name of smthng' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
fastify.get('/', opts, () => {}) | ||
fastify.ready(err => { | ||
t.error(err) | ||
const swaggerObject = fastify.swagger() | ||
t.equal(swaggerObject.definitions, swaggerInfo.swagger.definitions) | ||
}) | ||
}) | ||
test('hide support', t => { | ||
@@ -294,0 +329,0 @@ t.plan(2) |
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 too big to display
Sorry, the diff of this file is not supported yet
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
11152122
29
10749