diff --git a/benchmarks/compile/Cargo.toml b/benchmarks/compile/Cargo.toml index 44eb302..f4f0b8b 100644 --- a/benchmarks/compile/Cargo.toml +++ b/benchmarks/compile/Cargo.toml @@ -17,11 +17,7 @@ structs-10-fields-10 = [] validator = ["dep:validator"] [dependencies] -fortifier = { workspace = true, features = [ - "email-address", - "serde", - "url", -], optional = true } +fortifier = { workspace = true, features = ["email-address", "serde", "url"], optional = true } validator = { version = "0.20.0", features = ["derive"], optional = true } [lints] diff --git a/examples/basic/Cargo.toml b/examples/basic/Cargo.toml index 7162eaf..4a2f0dc 100644 --- a/examples/basic/Cargo.toml +++ b/examples/basic/Cargo.toml @@ -10,12 +10,7 @@ repository.workspace = true version.workspace = true [dependencies] -fortifier = { workspace = true, features = [ - "email-address", - "phone-number", - "regex", - "url", -] } +fortifier = { workspace = true, features = ["email-address", "phone-number", "regex", "url"] } regex.workspace = true tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } diff --git a/examples/server/Cargo.toml b/examples/server/Cargo.toml index eefa40c..5733913 100644 --- a/examples/server/Cargo.toml +++ b/examples/server/Cargo.toml @@ -11,13 +11,7 @@ version.workspace = true [dependencies] axum = "0.8.7" -fortifier = { workspace = true, features = [ - "email-address", - "regex", - "serde", - "url", - "utoipa", -] } +fortifier = { workspace = true, features = ["email-address", "regex", "serde", "url", "utoipa"] } serde = { workspace = true, features = ["derive"] } thiserror = "2.0.17" tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } diff --git a/packages/fortifier-macros-tests/Cargo.toml b/packages/fortifier-macros-tests/Cargo.toml index dfc7430..e94d071 100644 --- a/packages/fortifier-macros-tests/Cargo.toml +++ b/packages/fortifier-macros-tests/Cargo.toml @@ -22,11 +22,7 @@ ignored = ["chrono", "rust_decimal", "uuid"] chrono.workspace = true constant-string.workspace = true email_address.workspace = true -fortifier = { workspace = true, features = [ - "all-types", - "all-validations", - "serde", -] } +fortifier = { workspace = true, features = ["all-types", "all-validations", "serde"] } indexmap.workspace = true phonenumber.workspace = true pretty_assertions.workspace = true diff --git a/packages/fortifier/src/validations/length.rs b/packages/fortifier/src/validations/length.rs index 7823f22..542204a 100644 --- a/packages/fortifier/src/validations/length.rs +++ b/packages/fortifier/src/validations/length.rs @@ -37,7 +37,7 @@ pub enum LengthError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: LengthErrorCode, /// A human-readable error message. @@ -54,7 +54,7 @@ pub enum LengthError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: LengthErrorCode, /// A human-readable error message. @@ -71,7 +71,7 @@ pub enum LengthError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] 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 b73f90c..96e599a 100644 --- a/packages/fortifier/src/validations/phone_number.rs +++ b/packages/fortifier/src/validations/phone_number.rs @@ -30,7 +30,7 @@ pub enum PhoneNumberError { NoNumber { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: PhoneNumberErrorCode, /// A human-readable error message. @@ -41,7 +41,7 @@ pub enum PhoneNumberError { InvalidCountryCode { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: PhoneNumberErrorCode, /// A human-readable error message. @@ -52,7 +52,7 @@ pub enum PhoneNumberError { TooShortAfterIdd { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: PhoneNumberErrorCode, /// A human-readable error message. @@ -63,7 +63,7 @@ pub enum PhoneNumberError { TooShortNsn { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: PhoneNumberErrorCode, /// A human-readable error message. @@ -74,7 +74,7 @@ pub enum PhoneNumberError { TooLong { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: PhoneNumberErrorCode, /// A human-readable error message. @@ -85,7 +85,7 @@ pub enum PhoneNumberError { MalformedInteger { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: PhoneNumberErrorCode, /// A human-readable error message. @@ -96,7 +96,7 @@ pub enum PhoneNumberError { DisallowedCountryCode { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: PhoneNumberErrorCode, /// Allowed country codes. diff --git a/packages/fortifier/src/validations/range.rs b/packages/fortifier/src/validations/range.rs index 4435ffb..0f0f839 100644 --- a/packages/fortifier/src/validations/range.rs +++ b/packages/fortifier/src/validations/range.rs @@ -33,7 +33,7 @@ pub enum RangeError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: RangeErrorCode, /// A human-readable error message. @@ -50,7 +50,7 @@ pub enum RangeError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: RangeErrorCode, /// A human-readable error message. @@ -67,7 +67,7 @@ pub enum RangeError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: RangeErrorCode, /// A human-readable error message. @@ -84,7 +84,7 @@ pub enum RangeError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: RangeErrorCode, /// A human-readable error message. diff --git a/packages/fortifier/src/validations/regex.rs b/packages/fortifier/src/validations/regex.rs index bbf2fb7..e7d0c7c 100644 --- a/packages/fortifier/src/validations/regex.rs +++ b/packages/fortifier/src/validations/regex.rs @@ -50,7 +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))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: RegexErrorCode, /// A human-readable error message. diff --git a/packages/fortifier/src/validations/url.rs b/packages/fortifier/src/validations/url.rs index c8536d8..61df212 100644 --- a/packages/fortifier/src/validations/url.rs +++ b/packages/fortifier/src/validations/url.rs @@ -29,7 +29,7 @@ pub enum UrlError { EmptyHost { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: UrlErrorCode, /// A human-readable error message. @@ -40,7 +40,7 @@ pub enum UrlError { IdnaError { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: UrlErrorCode, /// A human-readable error message. @@ -51,7 +51,7 @@ pub enum UrlError { InvalidPort { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: UrlErrorCode, /// A human-readable error message. @@ -62,7 +62,7 @@ pub enum UrlError { InvalidIpv4Address { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: UrlErrorCode, /// A human-readable error message. @@ -73,7 +73,7 @@ pub enum UrlError { InvalidIpv6Address { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: UrlErrorCode, /// A human-readable error message. @@ -84,7 +84,7 @@ pub enum UrlError { InvalidDomainCharacter { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: UrlErrorCode, /// A human-readable error message. @@ -95,7 +95,7 @@ pub enum UrlError { RelativeUrlWithoutBase { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: UrlErrorCode, /// A human-readable error message. @@ -106,7 +106,7 @@ pub enum UrlError { RelativeUrlWithCannotBeABaseBase { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: UrlErrorCode, /// A human-readable error message. @@ -117,7 +117,7 @@ pub enum UrlError { SetHostOnCannotBeABaseUrl { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: UrlErrorCode, /// A human-readable error message. @@ -128,7 +128,7 @@ pub enum UrlError { Overflow { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: UrlErrorCode, /// A human-readable error message. @@ -139,7 +139,7 @@ pub enum UrlError { Unknown { /// The error code. #[cfg_attr(feature = "serde", serde(default))] - #[cfg_attr(feature = "utoipa", schema(inline))] + #[cfg_attr(feature = "utoipa", schema(inline, required))] code: UrlErrorCode, /// A human-readable error message.