You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there an obvious way to have garde respect serde rules (specifically, serde(rename_all = "camelCase")) for validation paths?
My public-facing input types are camel-cased to match the Javascript convention, but internally are snake-cased for Rust. When mapping errors back to form fields, I'd like to reflect the same convention.
Thanks.
The text was updated successfully, but these errors were encountered:
There is not, unfortunately. I don't know what the convention for that is, but it feels wrong to read serde's attributes for this.
Implementing our own rename attributes would probably look like:
Parsing the new attributes (rename on field-level, rename_all on struct-level)
Following the code to thread those attributes through to this line and update the key.to_string() based on whatever rename rule is used (either the struct-level case convert, or field-level rename to specific key, prioritizing the field-level over struct-level rename)
Thanks. Agreed, I think a garde-level rename makes sense 👍🏻 FWIW, I'm using Poem's #[oai(rename_all...) attribute for serialising input, which is effectively the same approach.
Is there an obvious way to have garde respect serde rules (specifically,
serde(rename_all = "camelCase")
) for validation paths?My public-facing input types are camel-cased to match the Javascript convention, but internally are snake-cased for Rust. When mapping errors back to form fields, I'd like to reflect the same convention.
Thanks.
The text was updated successfully, but these errors were encountered: