Why does not ValidationError contain field name ?
Closed this issue · 2 comments
HosMercury commented
as question
why does not this thing contain the field name?
pub struct ValidationError {
pub code: [Cow](https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html)<'static, [str](https://doc.rust-lang.org/nightly/std/primitive.str.html)>,
pub message: [Option](https://doc.rust-lang.org/nightly/core/option/enum.Option.html)<[Cow](https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html)<'static, [str](https://doc.rust-lang.org/nightly/std/primitive.str.html)>>,
pub params: [HashMap](https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html)<[Cow](https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html)<'static, [str](https://doc.rust-lang.org/nightly/std/primitive.str.html)>, [Value](https://docs.rs/serde_json/1.0.96/x86_64-unknown-linux-gnu/serde_json/value/enum.Value.html)>,
}
to use this field name in the frontend red color around the form field for example?
Keats commented
You get the field name from https://github.com/Keats/validator/blob/master/validator/src/types.rs#L43, it's stored in a hashmap
HosMercury commented
Aha Ty