Skip to content

AbstractDirectiveConstraint message does not show the correct value #62

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

Closed
paul-pop opened this issue Apr 13, 2022 · 0 comments · Fixed by #63
Closed

AbstractDirectiveConstraint message does not show the correct value #62

paul-pop opened this issue Apr 13, 2022 · 0 comments · Fixed by #63

Comments

@paul-pop
Copy link

paul-pop commented Apr 13, 2022

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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant