Skip to content

AbstractDirectiveConstraint message does not show the correct value #62

Closed
@paul-pop

Description

@paul-pop

Describe the bug
The AbstractDecimalMinMaxConstraint when used as part of DecimalMin or DecimalMax does not output the correct error message. Instead of showing the value passed in the directive as the parameter for the min or the max, it simply outputs the value that gets validated (the value being passed into the field).

Note: This works fine in all other constraints, including AbstractMinMaxConstraint which is similar. The issue is that the AbstractDecimalMinMaxConstraint passes in the validated value, not the directive value when composing the message.

To Reproduce
For this mutation and input:

mutation createModel(attributes: CreateModelAttributes!): Model
input CreateModelAttributes {
  value: BigDecimal @DecimalMin(value: "10", inclusive: true)
}

When passing in an invalid value like 1, will generate the following error message:

"/createModel/attributes/value must be greater than or equal to 1"

Instead, it should have generated:

"/createModel/attributes/value must be greater than or equal to 10"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions