- [FEATURE] In
no_std
generate implementation of::core::error::Error
if Rust version is 1.81 or higher. - [FIX] Enable to specify custom error as a path (see #186, #187)
- [FIX] Make
Deserialize
derive compile when combination ofno_std
andserde
features are used (#182) - [FIX] Fix lint warnings about inner generated module
- [FEATURE] Added support for custom error types and validation functions via the
error
andwith
attributes. - [BREAKING] Replaced
lazy_static
withstd::sync::LazyLock
for regex validation. This requires Rust 1.80 or higher and may cause compilation issues on older Rust versions due to the use ofstd::sync::LazyLock
. If upgrading Rust isn't an option, you can still uselazy_static
explicitly as a workaround. - [BREAKING] The fallible
::new()
constructor has been fully replaced by::try_new()
.
- Support generics
- [DEPRECATION] Fallible constructor
::new()
is deprecated. Users should use::try_new()
instead. - [FIX] Use absolute path for
::core::result::Result
when generating code forderive(TryFrom)
.
- Support
no_std
( the dependency needs to be declared asnutype = { default-features = false }
) - Support integration with
arbitrary
crate (seearbitrary
feature).- Support
Arbitrary
for integer types - Support
Arbitrary
for float types - Support
Arbitrary
for string inner types - Support
Arbitrary
for any inner types
- Support
- Possibility to specify boundaries (
greater
,greater_or_equal
,less
,less_or_equal
,len_char_min
,len_char_max
) with expressions or named constants. - Add
#[inline]
attribute to trivial functions - Improve error messages
- Failed release. Includes everything from v0.4.2 except support of
Arbitrary
forString
based types.
- Support of arbitrary inner types with custom sanitizers and validators.
- Add numeric validator
greater
- Add numeric validator
less
- [BREAKING] Removal of asterisk derive
- [BREAKING] Use commas to separate high level attributes
- [BREAKING] Traits are derived with
#[nutype(derive(Debug))]
. The regular#[derive(Debug)]
syntax is not supported anymore. - [BREAKING] Validator
with
has been renamed topredicate
to reflect the boolean nature of its range - [BREAKING] String validator
min_len
has been renamed tolen_char_min
to reflect that is based on UTF8 chars. - [BREAKING] String validator
max_len
has been renamed tolen_char_max
to reflect that is based on UTF8 chars. - [BREAKING] Rename numeric validator
max
toless_or_equal
- [BREAKING] Rename numeric validator
min
togreater_or_equal
- [BREAKING] Rename error variants to follow the following formula:
<ValidationRule>Violated
. This implies the following renames:TooShort
->LenCharMinViolated
TooLong
->LenCharMaxViolated
Empty
->NotEmptyViolated
RegexMismatch
->RegexViolated
Invalid
->PredicateViolated
TooBig
->LessOrEqualViolated
TooSmall
->GreaterOrEqualViolated
NotFinite
->FiniteViolated
- Better error messages: in case of unknown attribute, validator or sanitizer the possible values are listed.
- [FIX] Make derived
Deserialize
work with RON format
- Support deriving of
Deref
- [BREAKING]
min_len
andmax_len
validators run against number of characters in a string (val.chars().count()
), not number of bytes (val.len()
). - Add
finite
validation for float types which checks against NaN and infinity. - Support deriving of
Default
- Support deriving of
Eq
andOrd
on float types (iffinite
validation is present) - Support deriving of
TryFrom
for types without validation (in this case Error type isstd::convert::Infallible
)
- [BREAKING] Rename string validator
present
->not_empty
. Rename error variantMissing
->Empty
. - [BREAKING] Rename feature
serde1
toserde
. - Introduce
new_unchecked
feature flag, that allows to bypass sanitization and validation. - Support derive of
JsonSchema
ofschemars
crate (requiresschemars08
feature). - Support string validation with
regex
(requiresregex
feature).
- Initial release