Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Message interpolation does not work for expression language #61

Copy link
Copy link
@paul-pop

Description

@paul-pop
Issue body actions

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.

Reactions are currently unavailable

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.