Comparing version 0.2.1 to 0.2.2
@@ -61,2 +61,5 @@ "use strict"; | ||
} | ||
if (route.meta && route.meta.tags) { | ||
operation.tags = Array.isArray(route.meta.tags) ? route.meta.tags : [route.meta.tags]; | ||
} | ||
/** | ||
@@ -74,7 +77,9 @@ * Request Body | ||
try { | ||
const { description, ...schema } = joi_to_json_schema_1.default(route.validate.params[paramName]); | ||
return { | ||
name: paramName, | ||
description, | ||
in: 'path', | ||
required: true, | ||
schema: joi_to_json_schema_1.default(route.validate.params[paramName]) | ||
schema | ||
}; | ||
@@ -109,3 +114,3 @@ } | ||
const path = typeof route.path === 'string' | ||
? route.path.replace(/:(\w+)/, '{$1}') | ||
? route.path.replace(/:(\w+)/g, '{$1}') | ||
// TODO: warn the user that swagger doesn't accept regex as path | ||
@@ -165,2 +170,14 @@ : route.path.toString(); | ||
const description = schema.description || ''; | ||
// Remove the `patterns: []` property from the schema | ||
if (schema.properties) { | ||
for (const propertySchema of Object.values(schema.properties)) { | ||
if (propertySchema.items && propertySchema.items.patterns) { | ||
// The property is an array, so definition is inside `items` | ||
delete propertySchema.items.patterns; | ||
} | ||
else if (propertySchema.patterns) { | ||
delete propertySchema.patterns; | ||
} | ||
} | ||
} | ||
delete schema.description; | ||
@@ -167,0 +184,0 @@ delete schema.patterns; |
{ | ||
"name": "koa-spark", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Koa utility pack", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
27731
687