Skip to content
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

Message interpolation does not work for expression language #61

Open
paul-pop opened this issue Apr 13, 2022 · 1 comment
Open

Message interpolation does not work for expression language #61

paul-pop opened this issue Apr 13, 2022 · 1 comment

Comments

@paul-pop
Copy link
Contributor

paul-pop commented Apr 13, 2022

Describe the bug
When using variable interpolation using expression language (EL) in messages, an exception is thrown where the property that is used in the evaluation of the expression is not found so the EL part of the message does not get interpolated.

Exception thrown in the ElTermResolver#interpolate(...) method:

javax.el.PropertyNotFoundException: ELResolver cannot handle a null base Object with identifier 'inclusive'

To Reproduce
An example where this happens is in @DecimalMin (or @DecimalMax) that has the default messages:

graphql.validation.DecimalMax.message={path} must be less than ${inclusive == true ? 'or equal to ' : ''}{value}
graphql.validation.DecimalMin.message={path} must be greater than ${inclusive == true ? 'or equal to ' : ''}{value}

For example, this GraphQL mutation with inputs:

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 ${inclusive == true ? 'or equal to ' : ''}1"

The {path} and {value} are getting interpolated, but not the EL.

@louis1999
Copy link

Hello, i still have that error, is there a way to fix it ?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants