diff --git a/Cargo.lock b/Cargo.lock index 98f8f06..2fa3f85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -232,9 +232,9 @@ dependencies = [ [[package]] name = "constant-string" -version = "0.0.5" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce90aacfb6880505db3aed4b126006c685cf2df128c929edc2c25013f720612" +checksum = "fca1829c3b093c20be8a8c35d5dba5a251ae2e2e7bac8398b9364eb8cf77cd47" dependencies = [ "serde", "utoipa", diff --git a/Cargo.toml b/Cargo.toml index 0551e18..e3a2f3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" } diff --git a/packages/fortifier/src/validations/email_address.rs b/packages/fortifier/src/validations/email_address.rs index fc1f962..58a4325 100644 --- a/packages/fortifier/src/validations/email_address.rs +++ b/packages/fortifier/src/validations/email_address.rs @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. diff --git a/packages/fortifier/src/validations/length.rs b/packages/fortifier/src/validations/length.rs index 456b2f6..7823f22 100644 --- a/packages/fortifier/src/validations/length.rs +++ b/packages/fortifier/src/validations/length.rs @@ -37,6 +37,7 @@ pub enum LengthError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] + #[cfg_attr(feature = "utoipa", schema(inline))] code: LengthErrorCode, /// A human-readable error message. @@ -53,6 +54,7 @@ pub enum LengthError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] + #[cfg_attr(feature = "utoipa", schema(inline))] code: LengthErrorCode, /// A human-readable error message. @@ -69,6 +71,7 @@ pub enum LengthError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] + #[cfg_attr(feature = "utoipa", schema(inline))] code: LengthErrorCode, /// A human-readable error message. diff --git a/packages/fortifier/src/validations/phone_number.rs b/packages/fortifier/src/validations/phone_number.rs index 62835d8..b73f90c 100644 --- a/packages/fortifier/src/validations/phone_number.rs +++ b/packages/fortifier/src/validations/phone_number.rs @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. diff --git a/packages/fortifier/src/validations/range.rs b/packages/fortifier/src/validations/range.rs index c1bebb7..4435ffb 100644 --- a/packages/fortifier/src/validations/range.rs +++ b/packages/fortifier/src/validations/range.rs @@ -33,6 +33,7 @@ pub enum RangeError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] + #[cfg_attr(feature = "utoipa", schema(inline))] code: RangeErrorCode, /// A human-readable error message. @@ -49,6 +50,7 @@ pub enum RangeError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] + #[cfg_attr(feature = "utoipa", schema(inline))] code: RangeErrorCode, /// A human-readable error message. @@ -65,6 +67,7 @@ pub enum RangeError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] + #[cfg_attr(feature = "utoipa", schema(inline))] code: RangeErrorCode, /// A human-readable error message. @@ -81,6 +84,7 @@ pub enum RangeError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] + #[cfg_attr(feature = "utoipa", schema(inline))] code: RangeErrorCode, /// A human-readable error message. diff --git a/packages/fortifier/src/validations/regex.rs b/packages/fortifier/src/validations/regex.rs index 7999438..bbf2fb7 100644 --- a/packages/fortifier/src/validations/regex.rs +++ b/packages/fortifier/src/validations/regex.rs @@ -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. diff --git a/packages/fortifier/src/validations/url.rs b/packages/fortifier/src/validations/url.rs index 4a08eef..c8536d8 100644 --- a/packages/fortifier/src/validations/url.rs +++ b/packages/fortifier/src/validations/url.rs @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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.