-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
Two parts:
-
Add a
code: Option<Cow<'static, str>>field togarde::Error -
Add a way to set the code for a specific rule via the proc macro.
The unresolved question here is syntax:
Option A:
#[garde(length(min = 1, code = "custom_error_code"))]Option B:
#[garde(code("custom_error_code", length(min = 1)))](A) would require some hacks to "intercept" the code value during parsing. Both would work by intercepting the error returned by a rule and set its code field in the proc macro output. (B) seems easier to implement, but those coming from validator likely expect (A).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels