Releases: jprochazk/garde
Releases · jprochazk/garde
v0.10.0
Breaking changes
Errors
now has a newNested
variant.Display
now uses the output offlatten
instead of only recursively printing errors.
Fixes
Result
aliases declared in the same scope as the output of theValidate
derive macro will no longer cause conflicts. (#24)
New features
dive
now works together with other rules:
#[derive(garde::Validate)]
struct Item {
#[garde(ascii)]
field: String,
}
#[derive(garde::Validate)]
struct Example {
#[garde(length(min=1), dive)]
items: Vec<Item>,
}
- each field may now have any number of
custom
rules:
#[derive(garde::Validate)]
struct Example {
#[garde(custom(a), custom(b), custom(c))]
items: String,
}
What's Changed
- Fix hygiene of
Result
in derivedValidate
impl by @jprochazk in #24 - Add CI by @jprochazk in #25
- Derive macro refactor by @jprochazk in #28
Full Changelog: https://github.com/jprochazk/garde/compare/v0.9.2..v0.10.0
v0.9.2
What's Changed
- Fix hygiene of
Result
in derivedValidate
impl by @jprochazk in #24 - Add CI by @jprochazk in #25
New Contributors
Full Changelog: v0.9.1...v0.9.2
v0.9.1
What's Changed
- Added
byte_length
rule to list of validation rules in the readme andlib.rs
.
Full Changelog: https://github.com/jprochazk/garde/compare/v0.9.0..v0.9.1
v0.9.0
Breaking changes
garde::rules::length::Size
was renamed toHasLength
, and thesize
method tolength
- All rule traits working on string types now have blanket impls over
AsRef<str>
. This includes:alphanumeric
ascii
contains
credit_card
email
ip
pattern
phone_number
prefix
suffix
url
- Rule trait methods were renamed to match the pattern
validate_<rule>
, e.g.garde::rules::Url::try_parse_url
was changed tovalidate_url
.
Other changes
All the rule traits should now be fully documented.
Full Changelog: https://github.com/jprochazk/garde/compare/v0.8.1..v0.9.0
v0.8.1
Fixes
- Errors in rules were not being propagated correctly.
Before:
#[derive(Debug, garde::Validate)]
struct Test {
#[garde(length(min = -10))] // error: unrecognized rule
field: String,
}
After:
#[derive(Debug, garde::Validate)]
struct Test {
#[garde(length(min = -10))] // error: value must be a valid `usize`: invalid digit found in string
field: String,
}
Full Changelog: https://github.com/jprochazk/garde/compare/v0.8.0..v0.8.1
v0.8.0
Breaking changes
- Added
From<Result<(), Errors>> for Errors
andErrors::finish
to convert between the two easily
Other changes
- Added more guide-level documentation on:
- Implementing rules and
Validate
- Usage examples
- Custom rules + context
- Implementing rules and
Full Changelog: https://github.com/jprochazk/garde/compare/v0.7.0..v0.8.0
v0.7.0
Breaking changes
- Added
skip
rule - Each field in a struct or enum annotated
#[derive(garde::Validate)]
must now have:- At least one validation rule
- The
dive
rule, which performs validation of the nested value - The
skip
rule, which skips validating that field
What's Changed
- Require some validation or skip by @jprochazk in #17
Full Changelog: https://github.com/jprochazk/garde/compare/v0.6.1..v0.7.0
v0.6.1
Fixes
- Fixed deriving
Validate
for enums with tuple/struct variants that had more than one field
Full Changelog: https://github.com/jprochazk/garde/commits/v0.6.1
v0.6.0
Breaking changes
- Implemented
Validate
for&T
, variousstd
types, likeVec
,HashMap
, pointers, and other containers.
Full Changelog: https://github.com/jprochazk/garde/commits/v0.6.0
v0.5.0
Breaking changes
garde::error::Errors
type was changed to an enum (more explanation in #15)- Every rule in
garde::rules::*
now accepts constraint parameters as a tuple, e.g.prefix
isfn(value; &str, (pattern,): (&str,)) -> Result<(), Error>
What's Changed
- Implement nested validation and nested errors by @jprochazk in #15
Full Changelog: https://github.com/jprochazk/garde/commits/v0.5.0