From c3c08ff1954be88e1039125cfc1f9005a10808ae Mon Sep 17 00:00:00 2001 From: Yannick Cordinier Date: Mon, 14 Nov 2016 10:54:34 -0500 Subject: [PATCH] Bugfix: Do not validate regex if value is undefined --- js/RequestValidator.js | 2 +- js/RequestValidator.js.map | 2 +- tests/unit/RequestValidator.ts | 3 ++- ts/RequestValidator.ts | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/js/RequestValidator.js b/js/RequestValidator.js index ea2addb..6c7b8d3 100644 --- a/js/RequestValidator.js +++ b/js/RequestValidator.js @@ -140,7 +140,7 @@ var RequestValidator = (function () { if (RequestValidator.checkValues(input[key], paramValidation.values) !== true) { errorMessages.push(this.getErrorMessage(key, 'values', "Param " + key + " must belong to [" + paramValidation.values.toString() + "]")); } - if (paramValidation.regex && !paramValidation.regex.test(input[key])) { + if (input[key] !== undefined && paramValidation.regex && !paramValidation.regex.test(input[key])) { errorMessages.push(this.getErrorMessage(key, 'regex', "Param " + key + " must match regex " + paramValidation.regex)); } if (paramValidation.format && input[key] !== undefined) { diff --git a/js/RequestValidator.js.map b/js/RequestValidator.js.map index 831a304..489a76b 100644 --- a/js/RequestValidator.js.map +++ b/js/RequestValidator.js.map @@ -1 +1 @@ -{"version":3,"file":"RequestValidator.js","sourceRoot":"","sources":["../ts/RequestValidator.ts"],"names":[],"mappings":";AAAA,gCAA8B,mBAAmB,CAAC,CAAA;AAElD,IAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC7F,IAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAavE;IAKI,0BAAY,YAAyB;QAAzB,4BAAyB,GAAzB,oBAAyB;QAH7B,qBAAgB,GAAY,IAAI,CAAC;QAIrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;I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.ts index 901ace6..7d1814b 100644 --- a/tests/unit/RequestValidator.ts +++ b/tests/unit/RequestValidator.ts @@ -431,7 +431,8 @@ describe('RequestValidator', () => { description: {type: 'string', required: true, length: 3}, enabled: {type: 'boolean', required: true, length: 10}, designers: {type: 'array', required: true, length: 2}, - categories: {type: 'array', required: true, length: 2, regex: /\d/} + categories: {type: 'array', required: true, length: 2, regex: /\d/}, + countryCode: {type: 'string', required: false, regex: /^[A-Za-z]{2}$/} } } }, query: { diff --git a/ts/RequestValidator.ts b/ts/RequestValidator.ts index 8cb1da4..88a8d4d 100644 --- a/ts/RequestValidator.ts +++ b/ts/RequestValidator.ts @@ -219,7 +219,7 @@ export class RequestValidator { } // Check regex - if (paramValidation.regex && !paramValidation.regex.test(input[key])) { + if (input[key] !== undefined && paramValidation.regex && !paramValidation.regex.test(input[key])) { errorMessages.push( this.getErrorMessage(key, 'regex', `Param ${key} must match regex ${paramValidation.regex}`) );