`#[validate(...)]` helper attribute does not coexist with other helper attribute
Closed this issue · 3 comments
naskya commented
#[validate(...)]
helper attribute does not coexist with other ident-only (#[foo]
) helper attribute. The Test4
struct in the following code produces an compilation error.
// compiles
#[derive(Validate, Foo)]
struct Test1 {
#[validate(nested)]
a: A,
}
// compiles
#[derive(Validate, Foo)]
struct Test2 {
#[validate(nested)]
#[foo(foo)]
a: A,
}
// compiles
#[derive(Validate, Foo)]
struct Test3 {
#[validate(nested)]
#[foo = "foo"]
a: A,
}
// this does not compile
#[derive(Validate, Foo)]
struct Test4 {
#[validate(nested)]
#[foo]
a: A,
}
#[derive(Validate)]
struct A {}
https://github.com/naskya/validator-helper-attribute-example/actions/runs/9945289199/job/27473203363
error: You need to set at least one validator on field `a`
= note: If you want nested validation, use `#[validate(nested)]`
--> src/main.rs:26:5
|
26 | #[validate(nested)]
| ^
Anyway, thank you for maintaining this awesome project!
Keats commented
Looks like we might not be validating the name of the attribute?
Keats commented
Sorry I forgot about it. it's pushed now