Skip to content

Commit

Permalink
fix: check the name of #[foo] (name only) attributes (#340) (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
naskya authored Aug 5, 2024
1 parent bd5293e commit ecc5235
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion validator_derive/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl ValidateField {
let field_name = self.ident.clone().expect("Field is not a named field").to_string();
let field_attrs = &current_field.attrs;
for attr in field_attrs {
if matches!(attr.meta, syn::Meta::Path(_)) {
if attr.path().is_ident("validate") && matches!(attr.meta, syn::Meta::Path(_)) {
abort!(
current_field.span(), "You need to set at least one validator on field `{}`", field_name;
note = "If you want nested validation, use `#[validate(nested)]`"
Expand Down

0 comments on commit ecc5235

Please sign in to comment.