camunda / dmn-scala

DMN engine written in Scala

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FEEL expression fails to parse when referencing an itemComponent with a space in the name

twilger opened this issue · comments

Describe the bug
DMN models that contain itemDefinitions with itemComponents that include spaces in their name, throw a "failed to parse expression" error. An example from the included VacationDayCalculator.dmn model is: FEEL expression: failed to parse expression 'Years of Service(employee.start Date, calculation date)': Expected (!"(" | "." | parameters | StringIn("<=", ">=", "<", ">", "!=", "=") | "between" | "in" | "and" | "or" | end-of-input):1:19, found "(employee."

In this example, employee is of type Employee which is an itemDefinition containing an itemComponent "start Date". Note that 'calculation date' also contains a space, but it is a variable with a typeRef="date". We are not experiencing the same parse error with 'calculation date'.

To Reproduce
Steps to reproduce the behavior:

  1. Create a DMN model with an ItemDefinition that has an itemComponent, whose name contains a space.
  2. Create a valid FEEL expression that references the itemComponent that contains the space.

Expected behavior
The FEEL expression should successfully parse.

Environment

  • DMN engine version: 1.7.1
  • Integration:
    • Embedded as library in custom application

Note that when we create the DmnEngine object using the DmnEngine.Builder we are setting the following builder properties:

  • escapeNamesWithSpaces(true)
  • escapeNamesWithDashes(true)

Here is a sample DMN model that demonstrates the problem.
VacationDayCalculator.dmn.zip

@twilger thank you for reporting 👍

Please note that the support for whitespace is more of an experimental feature. I recommend replacing whitespace by camelCase or snake_case.

Done by #198 🚀