Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ version = "0.2.11"

[workspace.dependencies]
chrono = "0.4.42"
constant-string = "0.0.5"
constant-string = "1.0.1"
email_address = { version = "0.2.9", default-features = false }
fortifier = { path = "./packages/fortifier", version = "0.2.0" }
fortifier-macros = { path = "./packages/fortifier-macros", version = "0.2.0" }
Expand Down
17 changes: 17 additions & 0 deletions packages/fortifier/src/validations/email_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub enum EmailAddressError {
InvalidCharacter {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -44,6 +45,7 @@ pub enum EmailAddressError {
MissingSeparator {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -54,6 +56,7 @@ pub enum EmailAddressError {
LocalPartEmpty {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -64,6 +67,7 @@ pub enum EmailAddressError {
LocalPartTooLong {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -74,6 +78,7 @@ pub enum EmailAddressError {
DomainEmpty {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -84,6 +89,7 @@ pub enum EmailAddressError {
DomainTooLong {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -94,6 +100,7 @@ pub enum EmailAddressError {
SubDomainEmpty {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -104,6 +111,7 @@ pub enum EmailAddressError {
SubDomainTooLong {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -114,6 +122,7 @@ pub enum EmailAddressError {
DomainTooFew {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -124,6 +133,7 @@ pub enum EmailAddressError {
DomainInvalidSeparator {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -134,6 +144,7 @@ pub enum EmailAddressError {
UnbalancedQuotes {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -144,6 +155,7 @@ pub enum EmailAddressError {
InvalidComment {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -154,6 +166,7 @@ pub enum EmailAddressError {
InvalidIPAddress {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -164,6 +177,7 @@ pub enum EmailAddressError {
UnsupportedDomainLiteral {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -174,6 +188,7 @@ pub enum EmailAddressError {
UnsupportedDisplayName {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -184,6 +199,7 @@ pub enum EmailAddressError {
MissingDisplayName {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand All @@ -194,6 +210,7 @@ pub enum EmailAddressError {
MissingEndBracket {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: EmailAddressErrorCode,

/// A human-readable error message.
Expand Down
3 changes: 3 additions & 0 deletions packages/fortifier/src/validations/length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub enum LengthError<T> {

/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: LengthErrorCode,

/// A human-readable error message.
Expand All @@ -53,6 +54,7 @@ pub enum LengthError<T> {

/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: LengthErrorCode,

/// A human-readable error message.
Expand All @@ -69,6 +71,7 @@ pub enum LengthError<T> {

/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: LengthErrorCode,

/// A human-readable error message.
Expand Down
7 changes: 7 additions & 0 deletions packages/fortifier/src/validations/phone_number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub enum PhoneNumberError {
NoNumber {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: PhoneNumberErrorCode,

/// A human-readable error message.
Expand All @@ -40,6 +41,7 @@ pub enum PhoneNumberError {
InvalidCountryCode {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: PhoneNumberErrorCode,

/// A human-readable error message.
Expand All @@ -50,6 +52,7 @@ pub enum PhoneNumberError {
TooShortAfterIdd {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: PhoneNumberErrorCode,

/// A human-readable error message.
Expand All @@ -60,6 +63,7 @@ pub enum PhoneNumberError {
TooShortNsn {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: PhoneNumberErrorCode,

/// A human-readable error message.
Expand All @@ -70,6 +74,7 @@ pub enum PhoneNumberError {
TooLong {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: PhoneNumberErrorCode,

/// A human-readable error message.
Expand All @@ -80,6 +85,7 @@ pub enum PhoneNumberError {
MalformedInteger {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: PhoneNumberErrorCode,

/// A human-readable error message.
Expand All @@ -90,6 +96,7 @@ pub enum PhoneNumberError {
DisallowedCountryCode {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: PhoneNumberErrorCode,

/// Allowed country codes.
Expand Down
4 changes: 4 additions & 0 deletions packages/fortifier/src/validations/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub enum RangeError<T> {

/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: RangeErrorCode,

/// A human-readable error message.
Expand All @@ -49,6 +50,7 @@ pub enum RangeError<T> {

/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: RangeErrorCode,

/// A human-readable error message.
Expand All @@ -65,6 +67,7 @@ pub enum RangeError<T> {

/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: RangeErrorCode,

/// A human-readable error message.
Expand All @@ -81,6 +84,7 @@ pub enum RangeError<T> {

/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: RangeErrorCode,

/// A human-readable error message.
Expand Down
1 change: 1 addition & 0 deletions packages/fortifier/src/validations/regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ constant_string!(RegexErrorCode, REGEX_ERROR_CODE, "regex");
pub struct RegexError {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: RegexErrorCode,

/// A human-readable error message.
Expand Down
11 changes: 11 additions & 0 deletions packages/fortifier/src/validations/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub enum UrlError {
EmptyHost {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: UrlErrorCode,

/// A human-readable error message.
Expand All @@ -39,6 +40,7 @@ pub enum UrlError {
IdnaError {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: UrlErrorCode,

/// A human-readable error message.
Expand All @@ -49,6 +51,7 @@ pub enum UrlError {
InvalidPort {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: UrlErrorCode,

/// A human-readable error message.
Expand All @@ -59,6 +62,7 @@ pub enum UrlError {
InvalidIpv4Address {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: UrlErrorCode,

/// A human-readable error message.
Expand All @@ -69,6 +73,7 @@ pub enum UrlError {
InvalidIpv6Address {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: UrlErrorCode,

/// A human-readable error message.
Expand All @@ -79,6 +84,7 @@ pub enum UrlError {
InvalidDomainCharacter {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: UrlErrorCode,

/// A human-readable error message.
Expand All @@ -89,6 +95,7 @@ pub enum UrlError {
RelativeUrlWithoutBase {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: UrlErrorCode,

/// A human-readable error message.
Expand All @@ -99,6 +106,7 @@ pub enum UrlError {
RelativeUrlWithCannotBeABaseBase {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: UrlErrorCode,

/// A human-readable error message.
Expand All @@ -109,6 +117,7 @@ pub enum UrlError {
SetHostOnCannotBeABaseUrl {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: UrlErrorCode,

/// A human-readable error message.
Expand All @@ -119,6 +128,7 @@ pub enum UrlError {
Overflow {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: UrlErrorCode,

/// A human-readable error message.
Expand All @@ -129,6 +139,7 @@ pub enum UrlError {
Unknown {
/// The error code.
#[cfg_attr(feature = "serde", serde(default))]
#[cfg_attr(feature = "utoipa", schema(inline))]
code: UrlErrorCode,

/// A human-readable error message.
Expand Down
Loading