Open 0xDjole opened 11 months ago
pub struct CategoryCreatePayload { #[validate(length(min = 1, code = CategoryError::NotFound(String::from("HERE").to_string())))] pub name: String, #[validate(length(min = 1, code = "400.41"))] pub parent_id: Option<String>, pub tenant_id: String, #[validate(length(min = 1, code = "400.42"))] pub policies: Vec<PolicyCreatePayload>, }
I'd like to use string from enums as a code and not a hardcoded string. #[validate(length(min = 1, code = CategoryError::NotFound(String::from("HERE").to_string())))]
#[validate(length(min = 1, code = CategoryError::NotFound(String::from("HERE").to_string())))]
Like this
I'd like to use string from enums as a code and not a hardcoded string.
#[validate(length(min = 1, code = CategoryError::NotFound(String::from("HERE").to_string())))]
Like this