swagger-tools
Advanced tools
Comparing version 0.4.6 to 0.4.7
@@ -45,3 +45,3 @@ /* | ||
if (_.isFunction(value)) { | ||
handlerCache[controllerName + '#' + name] = value; | ||
handlerCache[controllerName + '_' + name] = value; | ||
} | ||
@@ -69,3 +69,3 @@ }); | ||
* The routing works such that any Swagger operation is expected to have a nickname like this: | ||
* {ControllerName}#{methodName}. We will then identify the controller by name from the controllers path (configurable) | ||
* {ControllerName}_{methodName}. We will then identify the controller by name from the controllers path (configurable) | ||
* and identify the route handler within the controller by name. | ||
@@ -72,0 +72,0 @@ * |
@@ -150,8 +150,11 @@ /* | ||
// Validate requiredness | ||
if (!_.isUndefined(param.required)) { | ||
if (param.required === true && _.isUndefined(val)) { | ||
throw new Error(invalidParamPrefix + 'is required'); | ||
} | ||
if (!_.isUndefined(param.required) && param.required === true && _.isUndefined(val)) { | ||
throw new Error(invalidParamPrefix + 'is required'); | ||
} | ||
// Quick return if the value is not present | ||
if (_.isUndefined(val)) { | ||
return; | ||
} | ||
// Validate the value type/format | ||
@@ -158,0 +161,0 @@ if (!isValid(val, param.type, param.format)) { |
{ | ||
"name": "swagger-tools", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"description": "Various tools for using and integrating with Swagger.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -74,7 +74,11 @@ The project provides various tools for integrating and interacting with Swagger. This project is in its infancy but | ||
// More coming on this shortly | ||
// Interpret Swagger resources and attach metadata to request - must be first in swagger-tools middleware chain | ||
app.use(swaggerMetadata(resourceListing, [petJson, storeJson, userJson])); | ||
app.use(swaggerRouter({useStubs: true, controllers: './controllers'})); | ||
// Validate Swagger requests | ||
app.use(swaggerValidator()); | ||
// Route validated requests to appropriate controller | ||
app.use(swaggerRouter({useStubs: true, controllers: './controllers'})); | ||
// ... | ||
@@ -81,0 +85,0 @@ ``` |
82152
1784
97