operaton / operaton/documentation
Add to Templating Engine Docs: InputParameter inline-scripts using templating engines fail to resolve when starting with ${ or #{
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:
<#list icecreamtypes as ict>
* ${ict}
</#list>
</camunda:inputParameter>
<camunda:inputParameter name="failing">
<camunda:script scriptFormat="freemarker">${name} likes:
<#list icecreamtypes as ict>
* ${ict}
</#list>
</camunda:inputParameter>
<camunda:inputParameter name="workaround">
<camunda:script scriptFormat="freemarker"><#-- leading comment prevents Operaton from treating this as a dynamic script-source expression (see StringUtil.isExpression) -->${name} likes:
<#list icecreamtypes as ict>
* ${ict}
</#list>
</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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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