From 09fbfe94100caa066e9e10a89c77710a2f5b0558 Mon Sep 17 00:00:00 2001 From: Rand McKinney Date: Wed, 28 Sep 2016 16:43:17 -0700 Subject: [PATCH] Update validations.js Add doc of allowNull options property per #372. Back-port 9a1ef08 --- lib/validations.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/validations.js b/lib/validations.js index 7e57533c..94246972 100644 --- a/lib/validations.js +++ b/lib/validations.js @@ -127,9 +127,11 @@ Validatable.validatesNumericalityOf = getConfigurator('numericality'); * ``` * * @param {String} propertyName Property name to validate. - * @options {Object} Options + * @options {Object} Options See below. * @property {Array} inArray Property must match one of the values in the array to be valid. - * @property {String} message Optional error message if property is not valid. Default error message: "is not included in the list". + * @property {String} message Optional error message if property is not valid. + * Default error message: "is not included in the list". + * @property {Boolean} allowNull Whether null values are allowed. */ Validatable.validatesInclusionOf = getConfigurator('inclusion'); @@ -142,6 +144,7 @@ Validatable.validatesInclusionOf = getConfigurator('inclusion'); * @options {Object} Options * @property {Array} inArray Property must match one of the values in the array to be valid. * @property {String} message Optional error message if property is not valid. Default error message: "is reserved". + * @property {Boolean} allowNull Whether null values are allowed. */ Validatable.validatesExclusionOf = getConfigurator('exclusion'); @@ -155,6 +158,7 @@ Validatable.validatesExclusionOf = getConfigurator('exclusion'); * @options {Object} Options * @property {RegExp} with Regular expression to validate format. * @property {String} message Optional error message if property is not valid. Default error message: " is invalid". + * @property {Boolean} allowNull Whether null values are allowed. */ Validatable.validatesFormatOf = getConfigurator('format'); @@ -176,6 +180,7 @@ Validatable.validatesFormatOf = getConfigurator('format'); * @param {Function} validatorFn Custom validation function. * @options {Object} Options See below. * @property {String} message Optional error message if property is not valid. Default error message: " is invalid". + * @property {Boolean} allowNull Whether null values are allowed. */ Validatable.validate = getConfigurator('custom'); @@ -205,8 +210,9 @@ Validatable.validate = getConfigurator('custom'); *``` * @param {String} propertyName Property name to validate. * @param {Function} validatorFn Custom validation function. - * @options {Object} Options See below + * @options {Object} Options See below. * @property {String} message Optional error message if property is not valid. Default error message: " is invalid". + * @property {Boolean} allowNull Whether null values are allowed. */ Validatable.validateAsync = getConfigurator('custom', { async: true }); @@ -231,6 +237,7 @@ Validatable.validateAsync = getConfigurator('custom', { async: true }); * @property {RegExp} with Regular expression to validate format. * @property {Array.} scopedTo List of properties defining the scope. * @property {String} message Optional error message if property is not valid. Default error message: "is not unique". + * @property {Boolean} allowNull Whether null values are allowed. */ Validatable.validatesUniquenessOf = getConfigurator('uniqueness', { async: true });