Skip to content

Commit c1effab

Browse files
committed
feat: support conditional event templates
Related to camunda/camunda-modeler#5400
1 parent 4e1f1b3 commit c1effab

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[
2+
{
3+
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
4+
"id": "io.camunda.examples.conditional",
5+
"name": "Conditional Event",
6+
"appliesTo": [
7+
"bpmn:Event"
8+
],
9+
"elementType": {
10+
"value": "bpmn:IntermediateCatchEvent",
11+
"eventDefinition": "bpmn:ConditionalEventDefinition"
12+
},
13+
"properties": [
14+
{
15+
"label": "Variable Names",
16+
"type": "String",
17+
"binding": {
18+
"type": "bpmn:ConditionalEventDefinition#zeebe:conditionalFilter#property",
19+
"name": "variableNamesWrong"
20+
}
21+
},
22+
{
23+
"label": "Variable Events",
24+
"type": "Hidden",
25+
"value": "create,update",
26+
"binding": {
27+
"type": "bpmn:ConditionalEventDefinition#zeebe:conditionalFilter#property",
28+
"name": "variableEvents"
29+
}
30+
}
31+
]
32+
}
33+
]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[
2+
{
3+
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
4+
"id": "io.camunda.examples.conditional",
5+
"name": "Conditional Event",
6+
"appliesTo": [
7+
"bpmn:Event"
8+
],
9+
"elementType": {
10+
"value": "bpmn:IntermediateCatchEvent",
11+
"eventDefinition": "bpmn:ConditionalEventDefinition"
12+
},
13+
"properties": [
14+
{
15+
"label": "Variable Names",
16+
"type": "String",
17+
"binding": {
18+
"type": "bpmn:ConditionalEventDefinition#zeebe:conditionalFilter#property",
19+
"name": "variableNames"
20+
}
21+
},
22+
{
23+
"label": "Variable Events",
24+
"type": "Hidden",
25+
"value": "create,update",
26+
"binding": {
27+
"type": "bpmn:ConditionalEventDefinition#zeebe:conditionalFilter#property",
28+
"name": "variableEvents"
29+
}
30+
}
31+
]
32+
}
33+
]

test/spec/validationSpec.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,43 @@ describe('Validator', function() {
10871087
});
10881088

10891089

1090+
it('should validate conditional event templates', function() {
1091+
1092+
// given
1093+
const samples = require('../fixtures/conditional-event.json');
1094+
1095+
// when
1096+
const {
1097+
valid,
1098+
results
1099+
} = validateAllZeebe(samples);
1100+
1101+
// then
1102+
expect(valid).to.be.true;
1103+
expect(results.length).to.eql(samples.length);
1104+
expect(results.every(r => r.valid)).to.be.true;
1105+
expect(results.map(r => r.object)).to.eql(samples);
1106+
});
1107+
1108+
1109+
it('should validate conditional event templates with errors', function() {
1110+
1111+
// given
1112+
const samples = require('../fixtures/conditional-event-broken.json');
1113+
1114+
// when
1115+
const {
1116+
valid,
1117+
results
1118+
} = validateAllZeebe(samples);
1119+
1120+
// then
1121+
expect(valid).to.be.false;
1122+
expect(results.every(r => !r.valid)).to.be.true;
1123+
expect(results.map(r => r.object)).to.eql(samples);
1124+
});
1125+
1126+
10901127
describe('property', function() {
10911128

10921129
it('should validate', function() {

0 commit comments

Comments
 (0)