Skip to content

fix: the $value placeholder is not replaced in validation error messages #921

Open

Description

@waji-io

Description

When triggered a validation error, the resulting error message with the variable $value shows the variable name instead of the actual value. Other ValidationError variables still work, like $property or $contraint1

Minimal code-snippet showcasing the problem

@Max(250, { message: '$property is too big. Maximum value is $constraint1, but actual is $value' })
limit: number = 100;

Expected behavior

Show the actual value of $value and not its name.

Actual behavior

Instead of seeing the following validation error message:

"limit is too big. Maximum value is 250, but actual is 500"

I am seeing this:

"limit is too big. Maximum value is 250, but actual is $value"

Version used

0.13.1

Activity

  1. added
    status: needs triage
    type: fix
    on Feb 18, 2021
  2. c0d3ster commented on Sep 23, 2021

    @c0d3ster

    duplicated here: #1046
    Has anyone dug into this one and found the issue? I'm experiencing this on validating a nested object input type

  3. added
    status: has PR
    and removed
    status: needs triage
    on Dec 9, 2022
  4. changed the title [-]ValidationError - Value of $value is not shown in validation error message[/-] [+]fix: the `$value` placeholder is not replaced in validation error messages[/+] on Dec 9, 2022
  5. added
    status: fixed
    and removed
    status: has PR
    on Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: fixedtype: fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions