Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create one message if length is too short and a different message if too long #360

Open
Pi-Cla opened this issue Nov 18, 2024 · 1 comment

Comments

@Pi-Cla
Copy link

Pi-Cla commented Nov 18, 2024

When I tried to update past 0.16 I now have a "Duplicate field length" bug when I try to use duplicate fields like so:

#[validate(
        length(min = 1, message = "cannot be empty"),
        length(max = 32, message = "must be <= 32 characters")
    )]
    pub name: String,

where I intentionally use two different length checks to create two different messages.

Is there a way to still create two different messages or will I have to just combine them into one message like: "string was empty or had more than 32 characters"?

@Keats
Copy link
Owner

Keats commented Nov 20, 2024

The messages should be dynamic depending on whether min/max/equal are set really

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants