@springworks/input-validator
Advanced tools
Comparing version 3.0.8 to 3.1.0
@@ -7,2 +7,3 @@ 'use strict'; | ||
var OBJECTID_REGEX = /^[0-9a-fA-F]{24}$/; | ||
var defaults = require('lodash.defaults'); | ||
@@ -113,3 +114,9 @@ | ||
function validateSchema(params, schema, opt_resource_name, opt_options) { | ||
var validated = joi.validate(params, schema, opt_options); | ||
var default_options = { | ||
abortEarly: false, | ||
stripUnknown: false, | ||
convert: true, | ||
presence: 'optional', | ||
}; | ||
var validated = joi.validate(params, schema, defaults(default_options, opt_options)); | ||
@@ -116,0 +123,0 @@ if (validated.error) { |
{ | ||
"name": "@springworks/input-validator", | ||
"version": "3.0.8", | ||
"version": "3.1.0", | ||
"description": "Module to help validate and filter input parameters.", | ||
@@ -39,4 +39,5 @@ "main": "index.js", | ||
"@springworks/error-factory": "1.2.3", | ||
"joi": "6.9.0" | ||
"joi": "6.9.0", | ||
"lodash.defaults": "^3.1.2" | ||
} | ||
} |
@@ -156,14 +156,11 @@ 'use strict'; | ||
err.output.payload.validation.should.have.keys([ | ||
'number_val' | ||
'number_val', 'date_val', 'object_id' | ||
]); | ||
// Check the restify part. | ||
err.toJSON().should.eql({ | ||
message: 'Validation Failed', | ||
errors: [ | ||
{ | ||
resource: 'resource', | ||
field: 'number_val', | ||
code: 'invalid' | ||
} | ||
{ code: 'invalid', field: 'number_val', resource: 'resource' }, | ||
{ code: 'invalid', field: 'date_val', resource: 'resource' }, | ||
{ code: 'invalid', field: 'object_id', resource: 'resource' } | ||
] | ||
@@ -170,0 +167,0 @@ }); |
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
17545
353
3
+ Addedlodash.defaults@^3.1.2
+ Addedlodash._baseassign@3.2.0(transitive)
+ Addedlodash._basecopy@3.0.1(transitive)
+ Addedlodash._bindcallback@3.0.1(transitive)
+ Addedlodash._createassigner@3.1.1(transitive)
+ Addedlodash._getnative@3.9.1(transitive)
+ Addedlodash._isiterateecall@3.0.9(transitive)
+ Addedlodash.assign@3.2.0(transitive)
+ Addedlodash.defaults@3.1.2(transitive)
+ Addedlodash.isarguments@3.1.0(transitive)
+ Addedlodash.isarray@3.0.4(transitive)
+ Addedlodash.keys@3.1.2(transitive)
+ Addedlodash.restparam@3.6.1(transitive)