When there are nested fields and multiple fields fail validation, the error messages lack a delimiter.

Open
#395 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Reproduce the nested UserQueryParams example with both page and size validation failures, then trace where the nested validation messages are aggregated. Done means the combined messages have a clear delimiter and a regression test covers multiple failing nested fields.

Written by the indexing model from the issue text.

Description

#[derive(Debug, Deserialize, Validate)]
#[serde(rename_all = "camelCase")]
pub struct UserQueryParams {
    keyword: Option<String>,
    #[validate(nested)]
    #[serde(flatten)]
    pagination: PaginationParams,
}

#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Validate)]
pub struct PaginationParams {
    #[validate(range(min = 1, message = "Page must be greater than 0."))]
    pub page: u64,
    #[validate(range(min = 1, max = 100, message = "The page size must be between 1 and 100."))]
    pub size: u64,
}

When there are nested fields and multiple fields fail validation, the error messages lack a delimiter.
I personally consider this to be a minor bug. If it was originally designed without a separator, I sincerely apologize for any inconvenience this may have caused

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.