operaton / operaton/documentation

Add to Templating Engine Docs: InputParameter inline-scripts using templating engines fail to resolve when starting with ${ or #{

Open Beginner friendly
#168 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4
Forks
15
Avg merge
7d 18h
Merged PRs (30d)
6

Description

I believe this behavior is rather curious, than an actual bug - Which is why I think the documentation should mention it

A simple example of an activity with input mappings below:

  • working = all is fine
  • failing = fails, because UEL does not do freemarker magic and fails to resolve '${ict}'
  • workaround = prepend with a comment so 'isExpression' evaluates to false
<bpmn:sendTask id="Act1" name="doesn't matter">
  <bpmn:extensionElements>
    <camunda:inputOutput>
      <camunda:inputParameter name="working">
        <camunda:script scriptFormat="freemarker">Hello ${name}, I heard you like:
&lt;#list icecreamtypes as ict&gt;
  * ${ict}
&lt;/#list&gt;
      </camunda:inputParameter>
      <camunda:inputParameter name="failing">
        <camunda:script scriptFormat="freemarker">${name} likes:
&lt;#list icecreamtypes as ict&gt;
  * ${ict}
&lt;/#list&gt;
      </camunda:inputParameter>
      <camunda:inputParameter name="workaround">
        <camunda:script scriptFormat="freemarker">&lt;#-- leading comment prevents Operaton from treating this as a dynamic script-source expression (see StringUtil.isExpression) --&gt;${name} likes:
&lt;#list icecreamtypes as ict&gt;
  * ${ict}
&lt;/#list&gt;
      </camunda:inputParameter>
    </camunda:inputOutput>
  </bpmn:extensionElements>
</bpmn:sendTask>

The reason is, that the input value is checked to be a dynamicExpression:
https://github.com/operaton/operaton/blob/main/engine/src/main/java/org/operaton/bpm/engine/impl/util/ScriptUtil.java#L195,
which calls:
https://github.com/operaton/operaton/blob/b272acfa5c6486e4a0e0b2ef89a692a64b65c423/commons/utils/src/main/java/org/operaton/commons/utils/StringUtil.java#L36


Suggestion:

  • Add to Templating Engine Docs, that starting a template expression with ${ or #{ leads to misinterpretation, which can be fixed by adding a comment or starting with a different character sequence.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the “Use a template engine” section of the linked Templating Engine Docs and review ScriptUtil.java and StringUtil.java at the referenced entry points to confirm the behavior. Done means the documentation explains the ${ and #{ leading-expression cases and records the comment or alternate-prefix workaround shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.