Skip to content

Commit c9e9626

Browse files
committed
fix: preserve variable types across merges
Ensure that variable types are preserved during context merges. Add test coverage for different cases.
1 parent d760636 commit c9e9626

File tree

6 files changed

+502
-4
lines changed

6 files changed

+502
-4
lines changed

lib/zeebe/util/feelUtility.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { EntriesContext } from './VariableContext';
99
import { getExtensionElementsList } from '../../base/util/ExtensionElementsUtil';
1010
import { getParents } from '../../base/util/scopeUtil';
1111
import { is } from 'bpmn-js/lib/util/ModelUtil';
12+
import { mergeList } from '../../base/util/listUtil';
1213

1314
export function parseVariables(variables) {
1415

@@ -92,6 +93,19 @@ function resolveReferences(variablesToResolve, allVariables) {
9293
// Ensure we don't copy the scope from the mapped variable
9394
computedResult.scope = variable.scope;
9495

96+
// If the same variable name was already resolved (e.g. via input mapping AND a task output),
97+
// merge the types so downstream expressions see the full union (e.g. 'Null|Number').
98+
const existing = rootContext.entries[variable.name];
99+
100+
if (existing) {
101+
const existingType = getType(existing.value);
102+
const newType = getType(computedResult.value);
103+
const mergedType = mergeList(existingType, newType, '|');
104+
if (mergedType) {
105+
computedResult.value.type = mergedType;
106+
}
107+
}
108+
95109
rootContext.entries[variable.name] = computedResult;
96110

97111
newVariables.push({

test/fixtures/zeebe/mappings/merging.bpmn

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1noegy9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.21.0-rc.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.1.0">
2+
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1noegy9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.44.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.1.0">
33
<bpmn:collaboration id="Collaboration_0val525">
4-
<bpmn:participant id="Participant_1" processRef="Process_1" />
5-
<bpmn:participant id="Participant_2" processRef="Process_2" />
6-
<bpmn:participant id="Participant_3" processRef="Process_3" />
4+
<bpmn:participant id="Participant_1" name="Participant_1" processRef="Process_1" />
5+
<bpmn:participant id="Participant_2" name="Participant_2" processRef="Process_2" />
6+
<bpmn:participant id="Participant_3" name="Participant_3" processRef="Process_3" />
77
</bpmn:collaboration>
88
<bpmn:process id="Process_1" isExecutable="true">
99
<bpmn:serviceTask id="mergeContext" name="Merging Contexts">
@@ -69,13 +69,15 @@
6969
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0val525">
7070
<bpmndi:BPMNShape id="Participant_0o063cf_di" bpmnElement="Participant_1" isHorizontal="true">
7171
<dc:Bounds x="160" y="80" width="600" height="250" />
72+
<bpmndi:BPMNLabel />
7273
</bpmndi:BPMNShape>
7374
<bpmndi:BPMNShape id="Activity_01ho8di_di" bpmnElement="mergeContext">
7475
<dc:Bounds x="210" y="140" width="100" height="80" />
7576
<bpmndi:BPMNLabel />
7677
</bpmndi:BPMNShape>
7778
<bpmndi:BPMNShape id="Participant_01gb904_di" bpmnElement="Participant_2" isHorizontal="true">
7879
<dc:Bounds x="160" y="380" width="600" height="250" />
80+
<bpmndi:BPMNLabel />
7981
</bpmndi:BPMNShape>
8082
<bpmndi:BPMNShape id="Activity_0da1xe8_di" bpmnElement="Activity_1p9raox">
8183
<dc:Bounds x="210" y="460" width="100" height="80" />
@@ -90,6 +92,7 @@
9092
</bpmndi:BPMNShape>
9193
<bpmndi:BPMNShape id="Participant_10nlgk8_di" bpmnElement="Participant_3" isHorizontal="true">
9294
<dc:Bounds x="160" y="680" width="600" height="250" />
95+
<bpmndi:BPMNLabel />
9396
</bpmndi:BPMNShape>
9497
<bpmndi:BPMNShape id="Activity_1lvesqk_di" bpmnElement="Activity_1d3l9mi">
9598
<dc:Bounds x="210" y="760" width="100" height="80" />
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1noegy9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.44.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.1.0">
3+
<bpmn:collaboration id="Collaboration_0bfthub">
4+
<bpmn:participant id="Participant_5" name="Participant_5" processRef="Process_5" />
5+
<bpmn:textAnnotation id="TextAnnotation_11jxolm">
6+
<bpmn:text>out: variable=15</bpmn:text>
7+
</bpmn:textAnnotation>
8+
<bpmn:textAnnotation id="TextAnnotation_0hvaina">
9+
<bpmn:text>out: variable="YES"</bpmn:text>
10+
</bpmn:textAnnotation>
11+
<bpmn:textAnnotation id="TextAnnotation_0a6f56c">
12+
<bpmn:text>out: processVariable=variable</bpmn:text>
13+
</bpmn:textAnnotation>
14+
<bpmn:association id="Association_0mgj708" associationDirection="None" sourceRef="TextAnnotation_11jxolm" targetRef="Task_7" />
15+
<bpmn:association id="Association_1crqt39" associationDirection="None" sourceRef="TextAnnotation_0hvaina" targetRef="Task_8" />
16+
<bpmn:association id="Association_153xn5j" associationDirection="None" sourceRef="TextAnnotation_0a6f56c" targetRef="SubProcess_2" />
17+
</bpmn:collaboration>
18+
<bpmn:process id="Process_5" isExecutable="false">
19+
<bpmn:subProcess id="SubProcess_2" name="SubProcess_2">
20+
<bpmn:extensionElements>
21+
<zeebe:ioMapping>
22+
<zeebe:input source="=true" target="variable" />
23+
<zeebe:output source="=variable" target="processVariable" />
24+
</zeebe:ioMapping>
25+
</bpmn:extensionElements>
26+
<bpmn:serviceTask id="Task_7" name="Task_7">
27+
<bpmn:extensionElements>
28+
<zeebe:ioMapping>
29+
<zeebe:output source="=15" target="variable" />
30+
</zeebe:ioMapping>
31+
</bpmn:extensionElements>
32+
</bpmn:serviceTask>
33+
<bpmn:serviceTask id="Task_8" name="Task_8">
34+
<bpmn:extensionElements>
35+
<zeebe:ioMapping>
36+
<zeebe:output source="=&#34;YES&#34;" target="variable" />
37+
</zeebe:ioMapping>
38+
</bpmn:extensionElements>
39+
</bpmn:serviceTask>
40+
</bpmn:subProcess>
41+
</bpmn:process>
42+
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
43+
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0bfthub">
44+
<bpmndi:BPMNShape id="BPMNShape_0vn8cer" bpmnElement="Participant_5" isHorizontal="true">
45+
<dc:Bounds x="160" y="150" width="600" height="250" />
46+
<bpmndi:BPMNLabel />
47+
</bpmndi:BPMNShape>
48+
<bpmndi:BPMNShape id="BPMNShape_146fpac" bpmnElement="SubProcess_2" isExpanded="true">
49+
<dc:Bounds x="280" y="170" width="350" height="200" />
50+
<bpmndi:BPMNLabel />
51+
</bpmndi:BPMNShape>
52+
<bpmndi:BPMNShape id="BPMNShape_04637di" bpmnElement="Task_7">
53+
<dc:Bounds x="320" y="230" width="100" height="80" />
54+
<bpmndi:BPMNLabel />
55+
</bpmndi:BPMNShape>
56+
<bpmndi:BPMNShape id="BPMNShape_10kyeqe" bpmnElement="Task_8">
57+
<dc:Bounds x="470" y="230" width="100" height="80" />
58+
<bpmndi:BPMNLabel />
59+
</bpmndi:BPMNShape>
60+
<bpmndi:BPMNEdge id="BPMNEdge_0hr5apg" bpmnElement="Association_153xn5j">
61+
<di:waypoint x="825" y="111" />
62+
<di:waypoint x="630" y="183" />
63+
</bpmndi:BPMNEdge>
64+
<bpmndi:BPMNEdge id="BPMNEdge_1wcm6xy" bpmnElement="Association_0mgj708">
65+
<di:waypoint x="400" y="430" />
66+
<di:waypoint x="400" y="310" />
67+
</bpmndi:BPMNEdge>
68+
<bpmndi:BPMNEdge id="BPMNEdge_1l3u2qg" bpmnElement="Association_1crqt39">
69+
<di:waypoint x="560" y="430" />
70+
<di:waypoint x="560" y="310" />
71+
</bpmndi:BPMNEdge>
72+
<bpmndi:BPMNShape id="BPMNShape_0ag0gxw" bpmnElement="TextAnnotation_11jxolm">
73+
<dc:Bounds x="360" y="430" width="140" height="30" />
74+
<bpmndi:BPMNLabel />
75+
</bpmndi:BPMNShape>
76+
<bpmndi:BPMNShape id="BPMNShape_0ns775a" bpmnElement="TextAnnotation_0hvaina">
77+
<dc:Bounds x="530" y="430" width="140" height="30" />
78+
<bpmndi:BPMNLabel />
79+
</bpmndi:BPMNShape>
80+
<bpmndi:BPMNShape id="BPMNShape_1yxv8dy" bpmnElement="TextAnnotation_0a6f56c">
81+
<dc:Bounds x="800" y="80" width="181" height="31" />
82+
<bpmndi:BPMNLabel />
83+
</bpmndi:BPMNShape>
84+
</bpmndi:BPMNPlane>
85+
</bpmndi:BPMNDiagram>
86+
</bpmn:definitions>
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_varResolution" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.44.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.9.0">
3+
<bpmn:process id="Process_varResolution" isExecutable="true">
4+
<bpmn:serviceTask id="literalNullTask" name="Literal Null">
5+
<bpmn:extensionElements>
6+
<zeebe:ioMapping>
7+
<zeebe:output source="=null" target="outNull" />
8+
</zeebe:ioMapping>
9+
</bpmn:extensionElements>
10+
<bpmn:outgoing>Flow_1</bpmn:outgoing>
11+
</bpmn:serviceTask>
12+
<bpmn:serviceTask id="literalStringTask" name="Literal String">
13+
<bpmn:extensionElements>
14+
<zeebe:ioMapping>
15+
<zeebe:output source="=&#34;hello&#34;" target="outString" />
16+
</zeebe:ioMapping>
17+
</bpmn:extensionElements>
18+
<bpmn:incoming>Flow_1</bpmn:incoming>
19+
<bpmn:outgoing>Flow_2</bpmn:outgoing>
20+
</bpmn:serviceTask>
21+
<bpmn:serviceTask id="literalNumberTask" name="Literal Number">
22+
<bpmn:extensionElements>
23+
<zeebe:ioMapping>
24+
<zeebe:output source="=42" target="outNumber" />
25+
</zeebe:ioMapping>
26+
</bpmn:extensionElements>
27+
<bpmn:incoming>Flow_2</bpmn:incoming>
28+
<bpmn:outgoing>Flow_3</bpmn:outgoing>
29+
</bpmn:serviceTask>
30+
<bpmn:serviceTask id="literalBooleanTask" name="Literal Boolean">
31+
<bpmn:extensionElements>
32+
<zeebe:ioMapping>
33+
<zeebe:output source="=true" target="outBoolean" />
34+
</zeebe:ioMapping>
35+
</bpmn:extensionElements>
36+
<bpmn:incoming>Flow_3</bpmn:incoming>
37+
<bpmn:outgoing>Flow_4</bpmn:outgoing>
38+
</bpmn:serviceTask>
39+
<bpmn:serviceTask id="literalContextTask" name="Literal Context">
40+
<bpmn:extensionElements>
41+
<zeebe:ioMapping>
42+
<zeebe:output source="={&#34;key&#34;: &#34;value&#34;}" target="outContext" />
43+
</zeebe:ioMapping>
44+
</bpmn:extensionElements>
45+
<bpmn:incoming>Flow_4</bpmn:incoming>
46+
<bpmn:outgoing>Flow_5</bpmn:outgoing>
47+
</bpmn:serviceTask>
48+
<bpmn:serviceTask id="emptySourceTask" name="Empty Source">
49+
<bpmn:extensionElements>
50+
<zeebe:ioMapping>
51+
<zeebe:output source="" target="outEmpty" />
52+
</zeebe:ioMapping>
53+
</bpmn:extensionElements>
54+
<bpmn:incoming>Flow_5</bpmn:incoming>
55+
<bpmn:outgoing>Flow_6</bpmn:outgoing>
56+
<bpmn:outgoing>Flow_1u936n5</bpmn:outgoing>
57+
</bpmn:serviceTask>
58+
<bpmn:serviceTask id="passthroughProducerTask" name="Passthrough Producer">
59+
<bpmn:extensionElements>
60+
<zeebe:ioMapping>
61+
<zeebe:output source="=&#34;world&#34;" target="strVar" />
62+
</zeebe:ioMapping>
63+
</bpmn:extensionElements>
64+
<bpmn:incoming>Flow_6</bpmn:incoming>
65+
<bpmn:outgoing>Flow_9</bpmn:outgoing>
66+
</bpmn:serviceTask>
67+
<bpmn:serviceTask id="passthroughConsumerTask" name="Passthrough Consumer">
68+
<bpmn:extensionElements>
69+
<zeebe:ioMapping>
70+
<zeebe:input source="=strVar" target="passedString" />
71+
</zeebe:ioMapping>
72+
</bpmn:extensionElements>
73+
<bpmn:incoming>Flow_9</bpmn:incoming>
74+
<bpmn:outgoing>Flow_10</bpmn:outgoing>
75+
</bpmn:serviceTask>
76+
<bpmn:serviceTask id="unresolvedConsumerTask" name="Unresolved Consumer">
77+
<bpmn:extensionElements>
78+
<zeebe:ioMapping>
79+
<zeebe:input source="=unknownVar" target="unresolvedInput" />
80+
</zeebe:ioMapping>
81+
</bpmn:extensionElements>
82+
<bpmn:incoming>Flow_10</bpmn:incoming>
83+
</bpmn:serviceTask>
84+
<bpmn:sequenceFlow id="Flow_1" sourceRef="literalNullTask" targetRef="literalStringTask" />
85+
<bpmn:sequenceFlow id="Flow_2" sourceRef="literalStringTask" targetRef="literalNumberTask" />
86+
<bpmn:sequenceFlow id="Flow_3" sourceRef="literalNumberTask" targetRef="literalBooleanTask" />
87+
<bpmn:sequenceFlow id="Flow_4" sourceRef="literalBooleanTask" targetRef="literalContextTask" />
88+
<bpmn:sequenceFlow id="Flow_5" sourceRef="literalContextTask" targetRef="emptySourceTask" />
89+
<bpmn:sequenceFlow id="Flow_6" sourceRef="emptySourceTask" targetRef="passthroughProducerTask" />
90+
<bpmn:sequenceFlow id="Flow_9" sourceRef="passthroughProducerTask" targetRef="passthroughConsumerTask" />
91+
<bpmn:sequenceFlow id="Flow_10" sourceRef="passthroughConsumerTask" targetRef="unresolvedConsumerTask" />
92+
<bpmn:serviceTask id="useUnknownVariable" name="Use unknown input">
93+
<bpmn:extensionElements>
94+
<zeebe:ioMapping>
95+
<zeebe:input source="outEmpty" target="localEmpty" />
96+
</zeebe:ioMapping>
97+
</bpmn:extensionElements>
98+
<bpmn:incoming>Flow_1u936n5</bpmn:incoming>
99+
</bpmn:serviceTask>
100+
<bpmn:sequenceFlow id="Flow_1u936n5" sourceRef="emptySourceTask" targetRef="useUnknownVariable" />
101+
</bpmn:process>
102+
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
103+
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_varResolution">
104+
<bpmndi:BPMNShape id="literalNullTask_di" bpmnElement="literalNullTask">
105+
<dc:Bounds x="160" y="100" width="100" height="80" />
106+
</bpmndi:BPMNShape>
107+
<bpmndi:BPMNShape id="literalStringTask_di" bpmnElement="literalStringTask">
108+
<dc:Bounds x="360" y="100" width="100" height="80" />
109+
</bpmndi:BPMNShape>
110+
<bpmndi:BPMNShape id="literalNumberTask_di" bpmnElement="literalNumberTask">
111+
<dc:Bounds x="560" y="100" width="100" height="80" />
112+
</bpmndi:BPMNShape>
113+
<bpmndi:BPMNShape id="literalBooleanTask_di" bpmnElement="literalBooleanTask">
114+
<dc:Bounds x="160" y="250" width="100" height="80" />
115+
</bpmndi:BPMNShape>
116+
<bpmndi:BPMNShape id="literalContextTask_di" bpmnElement="literalContextTask">
117+
<dc:Bounds x="360" y="250" width="100" height="80" />
118+
</bpmndi:BPMNShape>
119+
<bpmndi:BPMNShape id="emptySourceTask_di" bpmnElement="emptySourceTask">
120+
<dc:Bounds x="560" y="250" width="100" height="80" />
121+
</bpmndi:BPMNShape>
122+
<bpmndi:BPMNShape id="passthroughProducerTask_di" bpmnElement="passthroughProducerTask">
123+
<dc:Bounds x="560" y="400" width="100" height="80" />
124+
</bpmndi:BPMNShape>
125+
<bpmndi:BPMNShape id="passthroughConsumerTask_di" bpmnElement="passthroughConsumerTask">
126+
<dc:Bounds x="160" y="550" width="100" height="80" />
127+
</bpmndi:BPMNShape>
128+
<bpmndi:BPMNShape id="unresolvedConsumerTask_di" bpmnElement="unresolvedConsumerTask">
129+
<dc:Bounds x="360" y="550" width="100" height="80" />
130+
</bpmndi:BPMNShape>
131+
<bpmndi:BPMNShape id="BPMNShape_07drug3" bpmnElement="useUnknownVariable">
132+
<dc:Bounds x="760" y="250" width="100" height="80" />
133+
<bpmndi:BPMNLabel />
134+
</bpmndi:BPMNShape>
135+
<bpmndi:BPMNEdge id="Flow_1_di" bpmnElement="Flow_1">
136+
<di:waypoint x="260" y="140" />
137+
<di:waypoint x="360" y="140" />
138+
</bpmndi:BPMNEdge>
139+
<bpmndi:BPMNEdge id="Flow_2_di" bpmnElement="Flow_2">
140+
<di:waypoint x="460" y="140" />
141+
<di:waypoint x="560" y="140" />
142+
</bpmndi:BPMNEdge>
143+
<bpmndi:BPMNEdge id="Flow_3_di" bpmnElement="Flow_3">
144+
<di:waypoint x="610" y="180" />
145+
<di:waypoint x="610" y="220" />
146+
<di:waypoint x="210" y="220" />
147+
<di:waypoint x="210" y="250" />
148+
</bpmndi:BPMNEdge>
149+
<bpmndi:BPMNEdge id="Flow_4_di" bpmnElement="Flow_4">
150+
<di:waypoint x="260" y="290" />
151+
<di:waypoint x="360" y="290" />
152+
</bpmndi:BPMNEdge>
153+
<bpmndi:BPMNEdge id="Flow_5_di" bpmnElement="Flow_5">
154+
<di:waypoint x="460" y="290" />
155+
<di:waypoint x="560" y="290" />
156+
</bpmndi:BPMNEdge>
157+
<bpmndi:BPMNEdge id="Flow_6_di" bpmnElement="Flow_6">
158+
<di:waypoint x="610" y="330" />
159+
<di:waypoint x="610" y="370" />
160+
<di:waypoint x="210" y="370" />
161+
<di:waypoint x="210" y="440" />
162+
<di:waypoint x="560" y="440" />
163+
</bpmndi:BPMNEdge>
164+
<bpmndi:BPMNEdge id="Flow_9_di" bpmnElement="Flow_9">
165+
<di:waypoint x="610" y="480" />
166+
<di:waypoint x="610" y="520" />
167+
<di:waypoint x="210" y="520" />
168+
<di:waypoint x="210" y="550" />
169+
</bpmndi:BPMNEdge>
170+
<bpmndi:BPMNEdge id="Flow_10_di" bpmnElement="Flow_10">
171+
<di:waypoint x="260" y="590" />
172+
<di:waypoint x="360" y="590" />
173+
</bpmndi:BPMNEdge>
174+
<bpmndi:BPMNEdge id="Flow_1u936n5_di" bpmnElement="Flow_1u936n5">
175+
<di:waypoint x="660" y="290" />
176+
<di:waypoint x="760" y="290" />
177+
</bpmndi:BPMNEdge>
178+
</bpmndi:BPMNPlane>
179+
</bpmndi:BPMNDiagram>
180+
</bpmn:definitions>

test/spec/zeebe/Mappings.spec.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { ZeebeVariableResolverModule } from 'lib/';
1414
import chainedMappingsXML from 'test/fixtures/zeebe/mappings/chained-mappings.bpmn';
1515
import primitivesXML from 'test/fixtures/zeebe/mappings/primitives.bpmn';
1616
import mergingXML from 'test/fixtures/zeebe/mappings/merging.bpmn';
17+
import mergingChildrenXML from 'test/fixtures/zeebe/mappings/merging.children.bpmn';
1718
import scopeXML from 'test/fixtures/zeebe/mappings/scope.bpmn';
1819
import scriptTaskXML from 'test/fixtures/zeebe/mappings/script-task.bpmn';
1920
import scriptTaskEmptyExpressionXML from 'test/fixtures/zeebe/mappings/script-task-empty-expression.bpmn';
@@ -281,6 +282,42 @@ describe('ZeebeVariableResolver - Variable Mappings', function() {
281282
});
282283

283284

285+
describe('Merging - children types', function() {
286+
287+
beforeEach(bootstrap(mergingChildrenXML));
288+
289+
290+
it('should combine and child productions output', inject(async function(variableResolver, elementRegistry) {
291+
292+
// given
293+
const subProcess = elementRegistry.get('SubProcess_2');
294+
295+
createProvider({
296+
variables: [],
297+
variableResolver
298+
});
299+
300+
// when
301+
const variables = await variableResolver.getVariablesForElement(subProcess);
302+
303+
// then
304+
expect(variables).to.variableEqual([
305+
{
306+
name: 'processVariable',
307+
type: 'Boolean|Number|String',
308+
scope: 'Process_5'
309+
},
310+
{
311+
name: 'variable',
312+
type: 'Boolean|Number|String',
313+
scope: 'SubProcess_2'
314+
}
315+
]);
316+
}));
317+
318+
});
319+
320+
284321
describe('Scope', function() {
285322

286323
beforeEach(bootstrap(scopeXML));

0 commit comments

Comments
 (0)