Open
Description
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.
Metadata
Metadata
Assignees
Labels
No labels