Skip to content

Commit 302a096

Browse files
yT0n1barmac
authored andcommitted
feat: support zeebe:formDefinition binding property
Related to camunda/camunda-modeler#5073
1 parent 04d3835 commit 302a096

14 files changed

+644
-8
lines changed

packages/zeebe-element-templates-json-schema/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ All notable changes to [@camunda/zeebe-element-templates-json-schema](https://gi
66

77
___Note:__ Yet to be released changes appear here._
88

9+
* `FEAT`: support `zeebe:formDefinition` binding ([#169](https://github.com/camunda/element-templates-json-schema/pull/169)
10+
911
## 0.23.0
1012

1113
* `FEAT`: support `zeebe:userTask` binding property ([#162](https://github.com/camunda/element-templates-json-schema/pull/162))

packages/zeebe-element-templates-json-schema/src/defs/properties.json

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"bpmn:Message#zeebe:subscription#property",
5959
"zeebe:taskDefinition",
6060
"zeebe:calledElement",
61-
"zeebe:linkedResource"
61+
"zeebe:linkedResource",
62+
"zeebe:formDefinition"
6263
]
6364
}
6465
},
@@ -376,6 +377,51 @@
376377
}
377378
}
378379
}
380+
},
381+
{
382+
"if": {
383+
"properties": {
384+
"binding": {
385+
"properties": {
386+
"type": { "const": "zeebe:formDefinition" },
387+
"property": { "const": "formId" }
388+
},
389+
"required": ["type", "property"]
390+
}
391+
},
392+
"required": ["binding"]
393+
},
394+
"then": {
395+
"not": {
396+
"required": ["feel"]
397+
}
398+
}
399+
},
400+
{
401+
"if": {
402+
"properties": {
403+
"binding": {
404+
"properties": {
405+
"type": { "const": "zeebe:formDefinition" },
406+
"property": {"enum": ["externalReference", "formId"]}
407+
},
408+
"required": ["type", "property"]
409+
}
410+
},
411+
"required": ["binding"]
412+
},
413+
"then": {
414+
"required": [
415+
"type"
416+
],
417+
"properties": {
418+
"type": {
419+
"enum": [
420+
"Hidden", "String", "Text", "Dropdown"
421+
]
422+
}
423+
}
424+
}
379425
}
380426

381427
],
@@ -507,6 +553,31 @@
507553
]
508554
}
509555
},
556+
{
557+
"if": {
558+
"properties": {
559+
"type": {
560+
"const": "zeebe:formDefinition"
561+
}
562+
},
563+
"required": [
564+
"type"
565+
]
566+
},
567+
"then": {
568+
"properties": {
569+
"property": {
570+
"enum": [
571+
"formId",
572+
"externalReference"
573+
]
574+
}
575+
},
576+
"required": [
577+
"property"
578+
]
579+
}
580+
},
510581
{
511582
"$ref": "examples.json#/binding"
512583
}
@@ -528,7 +599,8 @@
528599
"zeebe:taskDefinition",
529600
"zeebe:calledElement",
530601
"zeebe:linkedResource",
531-
"zeebe:userTask"
602+
"zeebe:userTask",
603+
"zeebe:formDefinition"
532604
]
533605
},
534606
"name": {

packages/zeebe-element-templates-json-schema/src/defs/template.json

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
"bpmn:IntermediateThrowEvent",
6161
"bpmn:BoundaryEvent",
6262
"bpmn:EndEvent"
63-
6463
]
6564
}
6665
}
@@ -138,7 +137,6 @@
138137
"bpmn:IntermediateThrowEvent",
139138
"bpmn:BoundaryEvent",
140139
"bpmn:EndEvent"
141-
142140
]
143141
}
144142
}
@@ -184,7 +182,7 @@
184182
"properties"
185183
]
186184
},
187-
"then":{
185+
"then": {
188186
"anyOf": [
189187
{
190188
"required": [
@@ -209,7 +207,9 @@
209207
],
210208
"properties": {
211209
"appliesTo": {
212-
"const": [ "bpmn:CallActivity" ]
210+
"const": [
211+
"bpmn:CallActivity"
212+
]
213213
}
214214
}
215215
}
@@ -243,7 +243,7 @@
243243
"properties"
244244
]
245245
},
246-
"then":{
246+
"then": {
247247
"required": [
248248
"elementType"
249249
],
@@ -260,6 +260,64 @@
260260
}
261261
}
262262
}
263+
},
264+
{
265+
"if": {
266+
"properties": {
267+
"properties": {
268+
"contains": {
269+
"properties": {
270+
"binding": {
271+
"properties": {
272+
"type": {
273+
"const": "zeebe:formDefinition"
274+
}
275+
},
276+
"required": [
277+
"type"
278+
]
279+
}
280+
},
281+
"required": [
282+
"binding"
283+
]
284+
}
285+
}
286+
},
287+
"required": [
288+
"properties"
289+
]
290+
},
291+
"then": {
292+
"allOf": [
293+
{
294+
"properties": {
295+
"properties": {
296+
"contains": {
297+
"properties": {
298+
"binding": {
299+
"properties": {
300+
"type": {
301+
"const": "zeebe:userTask"
302+
}
303+
},
304+
"required": [
305+
"type"
306+
]
307+
}
308+
},
309+
"required": [
310+
"binding"
311+
]
312+
}
313+
}
314+
},
315+
"required": [
316+
"properties"
317+
]
318+
}
319+
]
320+
}
263321
}
264322
]
265323
}

packages/zeebe-element-templates-json-schema/src/error-messages.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,5 +193,31 @@
193193
"property"
194194
],
195195
"errorMessage": "invalid binding.property ${0}; must be any of { resourceId, resourceType, bindingType, versionTag }"
196+
},
197+
{
198+
"path": [
199+
"definitions",
200+
"properties",
201+
"allOf",
202+
1,
203+
"items",
204+
"allOf",
205+
13,
206+
"then"
207+
],
208+
"errorMessage": "Property \"formId\" cannot be a FEEL expression"
209+
},{
210+
"path": [
211+
"definitions",
212+
"template",
213+
"allOf",
214+
1,
215+
"allOf",
216+
4,
217+
"then",
218+
"allOf",
219+
0
220+
],
221+
"errorMessage": "When using \"zeebe:formDefinition\", \"zeebe:userTask\" must be set on the same element"
196222
}
197223
]
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
export const template = {
2+
'$schema': 'https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json',
3+
'name': 'Form Definition with external reference',
4+
'id': 'formDefinitionWithExternalReference',
5+
'appliesTo': [
6+
'bpmn:Task'
7+
],
8+
'elementType': {
9+
'value': 'bpmn:ServiceTask',
10+
},
11+
'properties': [
12+
{
13+
'type': 'Hidden',
14+
'binding': {
15+
'type': 'zeebe:userTask',
16+
}
17+
},
18+
{
19+
'type': 'Hidden',
20+
'value': 'aReference',
21+
'binding': {
22+
'type': 'zeebe:formDefinition',
23+
'property': 'externalReference'
24+
}
25+
}
26+
]
27+
};
28+
29+
// this is already guaranteed through zeebe:userTask binding
30+
31+
export const errors = [
32+
{
33+
keyword: 'const',
34+
dataPath: '/elementType/value',
35+
schemaPath: '#/allOf/1/allOf/3/then/properties/elementType/properties/value/const',
36+
params: {
37+
allowedValue: 'bpmn:UserTask'
38+
},
39+
message: 'should be equal to constant'
40+
},
41+
{
42+
keyword: 'if',
43+
dataPath: '',
44+
schemaPath: '#/allOf/1/allOf/3/if',
45+
params: {
46+
failingKeyword: 'then'
47+
},
48+
message: 'should match "then" schema'
49+
},
50+
{
51+
keyword: 'type',
52+
dataPath: '',
53+
schemaPath: '#/oneOf/1/type',
54+
params: {
55+
type: 'array'
56+
},
57+
message: 'should be array'
58+
},
59+
{
60+
keyword: 'oneOf',
61+
dataPath: '',
62+
schemaPath: '#/oneOf',
63+
params: {
64+
passingSchemas: null
65+
},
66+
message: 'should match exactly one schema in oneOf'
67+
}
68+
];

0 commit comments

Comments
 (0)