Skip to content

Commit 09fbfe9

Browse files
crandmckAmir-61
authored andcommitted
Update validations.js
Add doc of allowNull options property per #372. Back-port 9a1ef08
1 parent e3d76f7 commit 09fbfe9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/validations.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,11 @@ Validatable.validatesNumericalityOf = getConfigurator('numericality');
127127
* ```
128128
*
129129
* @param {String} propertyName Property name to validate.
130-
* @options {Object} Options
130+
* @options {Object} Options See below.
131131
* @property {Array} inArray Property must match one of the values in the array to be valid.
132-
* @property {String} message Optional error message if property is not valid. Default error message: "is not included in the list".
132+
* @property {String} message Optional error message if property is not valid.
133+
* Default error message: "is not included in the list".
134+
* @property {Boolean} allowNull Whether null values are allowed.
133135
*/
134136
Validatable.validatesInclusionOf = getConfigurator('inclusion');
135137

@@ -142,6 +144,7 @@ Validatable.validatesInclusionOf = getConfigurator('inclusion');
142144
* @options {Object} Options
143145
* @property {Array} inArray Property must match one of the values in the array to be valid.
144146
* @property {String} message Optional error message if property is not valid. Default error message: "is reserved".
147+
* @property {Boolean} allowNull Whether null values are allowed.
145148
*/
146149
Validatable.validatesExclusionOf = getConfigurator('exclusion');
147150

@@ -155,6 +158,7 @@ Validatable.validatesExclusionOf = getConfigurator('exclusion');
155158
* @options {Object} Options
156159
* @property {RegExp} with Regular expression to validate format.
157160
* @property {String} message Optional error message if property is not valid. Default error message: " is invalid".
161+
* @property {Boolean} allowNull Whether null values are allowed.
158162
*/
159163
Validatable.validatesFormatOf = getConfigurator('format');
160164

@@ -176,6 +180,7 @@ Validatable.validatesFormatOf = getConfigurator('format');
176180
* @param {Function} validatorFn Custom validation function.
177181
* @options {Object} Options See below.
178182
* @property {String} message Optional error message if property is not valid. Default error message: " is invalid".
183+
* @property {Boolean} allowNull Whether null values are allowed.
179184
*/
180185
Validatable.validate = getConfigurator('custom');
181186

@@ -205,8 +210,9 @@ Validatable.validate = getConfigurator('custom');
205210
*```
206211
* @param {String} propertyName Property name to validate.
207212
* @param {Function} validatorFn Custom validation function.
208-
* @options {Object} Options See below
213+
* @options {Object} Options See below.
209214
* @property {String} message Optional error message if property is not valid. Default error message: " is invalid".
215+
* @property {Boolean} allowNull Whether null values are allowed.
210216
*/
211217
Validatable.validateAsync = getConfigurator('custom', { async: true });
212218

@@ -231,6 +237,7 @@ Validatable.validateAsync = getConfigurator('custom', { async: true });
231237
* @property {RegExp} with Regular expression to validate format.
232238
* @property {Array.<String>} scopedTo List of properties defining the scope.
233239
* @property {String} message Optional error message if property is not valid. Default error message: "is not unique".
240+
* @property {Boolean} allowNull Whether null values are allowed.
234241
*/
235242
Validatable.validatesUniquenessOf = getConfigurator('uniqueness', { async: true });
236243

0 commit comments

Comments
 (0)