error: Duplicate field `regex`

Open
#344 4 comments 0 reactions 0 assignees View on GitHub

@rome-xi is already working on this.

Since Aug 24, 2026.

  • #399 by @rome-xi — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
backend

Research direction

Reproduce the duplicate-field error with the shown #[validate] attribute after upgrading from 0.16 to 0.18.1, then inspect the validation attribute handling involved in parsing repeated regex entries. Confirm whether multiple regex entries should be accepted and add a regression test covering the expected behavior.

Written by the indexing model from the issue text.

Description

bug

I updated from 0.16 to 0.18.1 and now it's throwing me error error: Duplicate field regex

    #[validate(
        length(
            min = 3,
            max = 20,
            message = "Username must be between 3 and 20 characters"
        ),
        regex(
            path = "USERNAME_ALLOWED_CHARACTERS",
            message = "Username must only contain alphanumeric characters and underscores"
        ),
        regex(
            path = "USERNAME_UNDERSCORE_LIMIT",
            message = "Username must contain no more than 1 underscore"
        ),
        regex(
            path = "USERNAME_UNDERSCORE_PLACEMENT",
            message = "Username must not start or end with an underscore"
        )
    )]

Thank you!

Dominant language
Rust
Stars
2.5k
Forks
190
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Keats/validator

All issues in Keats/validator

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.