aboutsummaryrefslogtreecommitdiffstats
path: root/validator_derive/src
AgeCommit message (Collapse)Author
2020-05-28required_nested implementationShadoySV
2020-05-20required validationShadoySV
2019-10-17Fix bug + cargo fmtVincent Prouillet
2019-10-14Update depsVincent Prouillet
2019-10-14Add utf-8 non-control chars validatorAndras Mocsary
2019-05-01Cargo fmt + edition 2018 for validatorVincent Prouillet
2019-05-01attr_literals is stable \o/Vincent Prouillet
2019-04-28Issue #69: Change `range` to require only one argCaroline Glassberg-Powell
Currently range is hard-coded to take both max and min. This is unhelpful in cases where we may only want to check one of the bounds. Update so that it behaves more like the `length` validator and can take either max or min, as well as both. Also ensure that at least one of them is supplied.
2018-09-13RustfmtVincent Prouillet
2018-09-13Nested Validation (#60)Simon Sparks
* Nested Validation Added support for a plain validate attribute on a struct's field to imply that validate() should be called on it with results being merged. Validation errors are now keyed with a string that indicates the path to the invalid field within a complex data structure. The errors themselves also include the path to the invalid field, expressed as a vector of strings. Added support for option and vector fields where the wrapped values perform nested validation. Refactored vector wrapping for more reusable nested validation quoting. Vector index is now more conveniently represented as an individual item in the ValidationError's path attribute. A few ergonomic changes to support custom (i.e. non-derived) Validate implementations. A custom Validator implementation may either implement the validate() method as before or implement the new validate_path(ValidationPath) method which gives context of where the validation is taking place in a complex data structure. It is not necessary to implement both methods. Refactored ValidationErrors to adopt a structure reflecting that of the data being validated. Instead of holding a vector of ValidationError instances for each field, the ValidationErrors map may now include 3 different kinds of error values representing the field, nested struct and nested vector of struct scenarios. Note that this implies a breaking change to the ValidationErrors map and the "inner" method signature for accessing errors programmatically compared to previous versions. Added new accessor methods to the ValidationErrors type for retrieving either field-level errors for a validated struct or all errors for the struct and it's nested children. The existing `inner` method provides the field-level behaviour for backwards compatibility and has been marked as deprecated. Documented the new associated functions of the ValidationErrors implementation and removed unnecessary feature declaration in a test module. Refactored tests to use the new `field_errors` accessor method. Updated README.md to describe nested validation behaviour. Keats/validator#31
2018-07-27Added support for validating Cow<'a, str> fields. (#56)Simon Sparks
* Added support for validating Cow<'a, str> fields. Keats/validator#55 * Corrected error message comparison in compiler-fail/length test. Keats/validator#55
2018-06-28Prepare for releaseVincent Prouillet
2018-06-20Update syn, quote and bump versionBastien Orivel
2018-05-29Some more tweaksVincent Prouillet
2018-05-29Prepare for releaseVincent Prouillet
2018-05-15feature gate card validatorErin
2018-04-13fix path parsing for regex validatorsErin
see also: 8ca1fe94d779dcccf4b3f4c23a08f3ede7e10956
2018-03-20Merge pull request #44 from csharad/double-optionVincent Prouillet
Support for validating Option<Option<T>>. Fixes #41
2018-03-18Fix path parsing for custom validatorsBastien Orivel
`::foo::bar` isn't a valid ident in syn 0.12. This lead to some code failing to compile if it was using paths as custom validators. This fixes it and adds a test.
2018-03-18Optional validator params and wraping for Option<Option<T>>Sharad Chand
2018-03-18Added assertions for Option<Option<T>>Sharad Chand
2018-03-16Bump syn to 0.12 and quote to 0.4Bastien Orivel
2018-01-28Don't emit a warning when a struct with no validator derives ValidateBastien Orivel
2017-12-17Move extraction of message and code in single functiongtors
2017-11-08Feature gate phone feature in validator_derive as wellVincent Prouillet
2017-11-08Add missing credit_card derive implVincent Prouillet
2017-11-07Ability to validate an international phone numberValerian Saliou
Signed-off-by: Valerian Saliou <valerian@valeriansaliou.name> Derives for the ‘phone’ validator (still unsure about it) Signed-off-by: Valerian Saliou <valerian@valeriansaliou.name> Fix review Merge + Add missing documented ‘credit_cards’ feature Signed-off-by: Valerian Saliou <valerian@valeriansaliou.name> Fix Signed-off-by: Valerian Saliou <valerian@valeriansaliou.name> Fix Signed-off-by: Valerian Saliou <valerian@valeriansaliou.name> Merge Signed-off-by: Valerian Saliou <valerian@valeriansaliou.name> ‘credit_cards’ feature is no longer needed as per #33 Signed-off-by: Valerian Saliou <valerian@valeriansaliou.name>
2017-05-28RevampVincent Prouillet
2017-05-22Added missing signs; fixes issue #23René Perschon
2017-02-10Ignore unused ident in patterntheduke
2017-02-10validator_derive: Properly skip foreign attributes.theduke
The old code only skips attributes if they are MetaItem::List. With a simple change, all attributes are skipped if they are not named "validate".
2017-01-19Validators work for Option<TYPE>Vincent Prouillet
2017-01-19Validator works for Option<&Vincent Prouillet
2017-01-19Make it work with lifetimesVincent Prouillet
2017-01-18Add regex validatorVincent Prouillet
2017-01-18Add contains validatorVincent Prouillet
2017-01-17validator_derive v0.2Vincent Prouillet
2017-01-17Remove need for attr_literalsVincent Prouillet
2017-01-16Struct level validationVincent Prouillet
2017-01-16Update regex and drop proc_macro feature, its stableVincent Prouillet
2016-12-29Added must_matchVincent Prouillet
2016-12-28Initial commitVincent Prouillet