Diana Lau
251ced811b
Update copyright year and CODEOWNERS ( #1818 )
...
* chore: update CODEOWNERS
* chore: update copyright years
2020-01-21 13:12:14 -05:00
Miroslav Bajtoš
1b7858a857
chore: update eslint to 6.x
...
Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
2019-12-03 10:09:16 +01:00
Agnes Lin
de4718d5b8
chore: update copyrights years ( #1737 )
2019-05-08 11:45:37 -04:00
Miroslav Bajtoš
9e0f624ad5
manually fix remaining problems
2018-12-07 16:46:15 +01:00
Miroslav Bajtoš
422ec9ad4f
autofix eslint errors
2018-12-07 16:46:15 +01:00
Miroslav Bajtoš
d2ee73b9d3
Update eslint + config to latest
2018-06-12 09:13:32 +02:00
bmatson
c3e502032e
Pass options argument to custom validators
2018-03-22 15:51:21 +01:00
Joost de Bruijn
f18d3487c6
validations: use new regex per evaluation ( #1479 )
...
The RegExp is cloned before executing the test. Fixing issue #1475 .
2017-09-01 12:48:29 -04:00
Tom Kirkpatrick
138b99c703
fix: support numbers in validatesFormatOf
...
Fix for #1437
2017-08-03 14:47:11 -04:00
Simo Moujami
82a8e3d9a1
#1386 Allow empty values when allowBlank is true
2017-07-19 19:26:13 -04:00
ssh24
98174251f1
Fix mixins/validatable docs
2017-06-06 14:21:49 -04:00
Bram Borggreve
c3629633de
Add caseInsensitive opt to validatesUniquenessOf
2017-05-01 17:26:16 -05:00
Diana Lau
a488a71dbd
replace exception thrown for invalid dates
2017-04-21 15:57:11 -04:00
Rémi Bèges
11c2a19ad2
Add tests for validatesExclusionOf ( #1248 )
2017-03-08 10:24:18 -05:00
Boštjan Pišler
93a739d612
Fixed example for creating ValidationError
2016-11-29 16:04:53 +01:00
CerealGuy
662458dc2c
Fix validateNumericality, nullCheck & add tests
...
validateNumericality didn't test if attributes value is a number
only if it's type is number.
Further nullCheck had a wrong testing order. It first checked if
value is null, later if blank. Also null check only used two equals,
not three. We don't use blank() anymore, testing if variable is
undefined should be fine too.
Added tests covering validateNumericality.
2016-10-15 10:59:22 +02:00
Simon Ho
b089b0d786
Fix linting errors
...
Trailing spaces in comments causing linter to fail. Errors introduced
at commit 9a1ef08495
.
2016-09-29 19:28:02 -07:00
Rand McKinney
9a1ef08495
Update validations.js
...
Add doc of allowNull options property per #372 .
2016-09-28 16:43:17 -07:00
David Cheung
805db78e19
Strict mode now always return validationError
...
- Deprecation of strict:validate and strict:throw
- When strict mode is enabled, it will now always
return validation error (previous strict:validate)
2016-09-19 10:27:24 -04:00
Amir Jafarian
aec678d252
Fix manually
2016-08-22 19:20:12 -04:00
Amir Jafarian
aa6d28268b
Auto-update by eslint --fix
2016-08-22 15:12:25 -04:00
Amir Jafarian
4ce5b5d3a0
Support for globalization
2016-07-28 15:20:18 -04:00
Rand McKinney
45e14af4a9
Update validations.js
...
Fix API doc per https://github.com/strongloop/loopback/issues/2472
2016-06-29 16:13:44 -07:00
RobinBiondi
fbe58f7cf8
give options to validators #984
2016-06-24 14:44:43 -07:00
Miroslav Bajtoš
27c6279d6c
fix remaining eslint issues
2016-04-05 15:25:34 +02:00
Miroslav Bajtoš
39e04a1756
eslint --fix
2016-04-05 15:25:34 +02:00
Ryan Graham
c467b43c38
Insert copyright headers
2016-04-04 18:14:03 -07:00
Rand McKinney
0e2d2c162e
Update validations.js
...
Fix small mistake in doc comment.
2015-09-04 16:31:54 -07:00
Fabien Franzen
6ce47f71b4
Correctly handle validatesUniquenessOf(idName)
2015-07-13 12:56:49 +02:00
Samuel Reed
b73f9f1bd4
Don't silently swallow db errors on validation.
2015-05-28 11:54:01 -05:00
Miroslav Bajtoš
40eecd98c9
validations: treat `NaN` as a blank value
...
When a required number property is set to NaN, for example as a result
of coersion (`Number([1,2,3])`), the "presence" validation now correctly
reports an error.
2015-04-22 19:57:48 +02:00
Miroslav Bajtoš
99d4c6aa8d
Add new strict mode "validate"
...
When a model is configured with `strict: 'validate'`,
any dynamic properties not included in the schema trigger
a validation error.
2015-04-14 08:16:10 +02:00
crandmck
d4b0a26a0e
Improved and corrected API docs
2015-03-04 17:21:25 -08:00
crandmck
e81415ceda
Fix problems in annotations that prvented validateAsync and validate functions from appearing in API docs.
2015-03-03 16:58:19 -08:00
James Billingham
28f3f5d9f8
Fixed nullCheck in validations to correct behavior when dealing with undefined attributes
2015-01-27 22:18:47 +00:00
Miroslav Bajtoš
9b759c95ac
Include property value in the error message
...
When building a list of errors for `ValidationError.message`, include
the values of invalid properties too.
In order to keep the message reasonably short, the values are truncated
at approx 32 characters.
2015-01-12 17:12:18 +01:00
Clark Wang
973dd33d63
fix skipping async validator will always fail if condition is un-fulfilled
...
If the validator configured with `{async:true}` option and `if/unless`
condition, validator should be skipped when the condition is un-fulfilled,
so the validator should be pass.
But currently, when skipping the validator, it calls `done(true)` which
accepts a `fail` flag as a param, this will fail the entire validation.
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-11-19 21:50:08 +08:00
Fabien Franzen
a66e612c87
Fix multi-property validation definitions
...
Fixes #291 , as introduced by me ...
https://github.com/strongloop/loopback-datasource-juggler/commit/6fae8c7
27759256157bf7ccd82e04ee372a59088
2014-09-05 18:00:11 +02:00
Fabien Franzen
6fae8c7277
Remove iteration of config args
...
Fixes #154 - args should only contain the property name at that point,
not loop over it.
2014-08-26 18:01:23 +02:00
Fabien Franzen
86ea107550
Validations configuration as object
...
Previously validations were appended to an array when configured. The
format was cumbersome, and led to issues. This refactors the
configuration into an object, as a property of the Model.
Note that if no validations have been configured, this property is
currently `undefined`.
2014-08-26 17:51:01 +02:00
Fabien Franzen
73330113ae
Applied Coobaha's PR fix - prevents undefined values
2014-08-26 17:15:07 +02:00
Fabien Franzen
bed97a75cb
Expose validation metadata
...
The new Validatable.validations mixin method returns the validations as
an object
indexed by property name.
2014-08-26 16:56:09 +02:00
Raymond Feng
fc710ca55a
Merge branch 'master' into 2.0
2014-07-15 17:09:20 -07:00
Raymond Feng
dc6ada6348
Merge pull request #165 from strongloop/feature/allow-hook-skip-next
...
Pass callback to hooks so that next can be skipped
2014-07-15 12:53:52 -07:00
Raymond Feng
9325ce316b
Allow before hooks to pass arguments to next()
2014-07-15 12:51:33 -07:00
Fabien Franzen
61f6d49518
Fix validateUniqueness/nextTick
2014-07-11 23:55:15 +02:00
Fabien Franzen
50656b8206
Handle custom error codes
...
Fixes #151
2014-07-11 23:03:07 +02:00
Fabien Franzen
a58dbe3a54
More validations and tests
...
Added validatesAbsenceOf. Handle async with if/unless prevention of
validators correctly. See: #170 #158
2014-07-11 22:56:02 +02:00
Fabien Franzen
5f1431aa05
Don't check uniqueness of blank values
2014-07-11 22:07:57 +02:00
Miroslav Bajtoš
3572ecd12d
validations: support non-V8 browsers
...
Call `Error.captureStackTrace()` only when it is available.
Use `this.stack = (new Error).stack` when `captureStackTrace` is not
available but the `stack` property is (Firefox).
2014-06-23 14:39:37 +02:00