Skip to content

Commit 71f2aed

Browse files
authored
feat: support zeebe:assignmentDefinition
Related to camunda/camunda-modeler#5091
1 parent 1baf568 commit 71f2aed

19 files changed

+892
-42
lines changed

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

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

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

9+
## 0.27.0
10+
11+
* `FEAT`: support `zeebe:assignmentDefinition` ([#186](https://github.com/camunda/element-templates-json-schema/pull/186))
12+
913
## 0.26.0
1014

1115
* `FEAT`: support `bindingType` property for linked element extensions ([#173](https://github.com/camunda/element-templates-json-schema/pull/173), [#183](https://github.com/camunda/element-templates-json-schema/pull/183))

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
"zeebe:linkedResource",
6262
"zeebe:formDefinition",
6363
"zeebe:calledDecision",
64-
"zeebe:script"
64+
"zeebe:script",
65+
"zeebe:assignmentDefinition"
6566
]
6667
}
6768
},
@@ -611,6 +612,9 @@
611612
},
612613
{
613614
"$ref": "./properties/bindingType.json"
615+
},
616+
{
617+
"$ref": "./properties/assignmentDefinition.json"
614618
}
615619
],
616620
"properties": {
@@ -824,6 +828,9 @@
824828
]
825829
}
826830
},
831+
{
832+
"$ref": "./properties/binding/assignmentDefinition.json"
833+
},
827834
{
828835
"$ref": "examples.json#/binding"
829836
}
@@ -848,7 +855,8 @@
848855
"zeebe:userTask",
849856
"zeebe:formDefinition",
850857
"zeebe:calledDecision",
851-
"zeebe:script"
858+
"zeebe:script",
859+
"zeebe:assignmentDefinition"
852860
]
853861
},
854862
"name": {
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"if": {
3+
"properties": {
4+
"binding": {
5+
"properties": {
6+
"type": {
7+
"const": "zeebe:assignmentDefinition"
8+
},
9+
"property": {
10+
"enum": [
11+
"assignee",
12+
"candidateUsers",
13+
"candidateGroups"
14+
]
15+
}
16+
},
17+
"required": [
18+
"type",
19+
"property"
20+
]
21+
}
22+
},
23+
"required": [
24+
"binding"
25+
]
26+
},
27+
"then": {
28+
"required": [
29+
"type"
30+
],
31+
"properties": {
32+
"type": {
33+
"enum": [
34+
"Hidden",
35+
"String",
36+
"Text",
37+
"Dropdown"
38+
]
39+
}
40+
}
41+
}
42+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"if": {
3+
"properties": {
4+
"type": {
5+
"const": "zeebe:assignmentDefinition"
6+
}
7+
},
8+
"required": [
9+
"type"
10+
]
11+
},
12+
"then": {
13+
"properties": {
14+
"property": {
15+
"enum": [
16+
"assignee",
17+
"candidateUsers",
18+
"candidateGroups"
19+
]
20+
}
21+
},
22+
"required": [
23+
"property"
24+
]
25+
}
26+
}

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

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,10 @@
298298
"binding": {
299299
"properties": {
300300
"type": {
301-
"const": "zeebe:formDefinition"
301+
"enum": [
302+
"zeebe:formDefinition",
303+
"zeebe:assignmentDefinition"
304+
]
302305
}
303306
},
304307
"required": [
@@ -317,33 +320,29 @@
317320
]
318321
},
319322
"then": {
320-
"allOf": [
321-
{
322-
"properties": {
323+
"properties": {
324+
"properties": {
325+
"contains": {
323326
"properties": {
324-
"contains": {
327+
"binding": {
325328
"properties": {
326-
"binding": {
327-
"properties": {
328-
"type": {
329-
"const": "zeebe:userTask"
330-
}
331-
},
332-
"required": [
333-
"type"
334-
]
329+
"type": {
330+
"const": "zeebe:userTask"
335331
}
336332
},
337333
"required": [
338-
"binding"
334+
"type"
339335
]
340336
}
341-
}
342-
},
343-
"required": [
344-
"properties"
345-
]
337+
},
338+
"required": [
339+
"binding"
340+
]
341+
}
346342
}
343+
},
344+
"required": [
345+
"properties"
347346
]
348347
}
349348
},

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
"properties",
150150
"type"
151151
],
152-
"errorMessage": "invalid property.binding type ${0}; must be any of { property, zeebe:taskDefinition:type, zeebe:input, zeebe:output, zeebe:property, zeebe:taskHeader, bpmn:Message#property, bpmn:Message#zeebe:subscription#property, zeebe:taskDefinition, zeebe:calledElement, zeebe:linkedResource, zeebe:userTask, zeebe:formDefinition, zeebe:calledDecision, zeebe:script }"
152+
"errorMessage": "invalid property.binding type ${0}; must be any of { property, zeebe:taskDefinition:type, zeebe:input, zeebe:output, zeebe:property, zeebe:taskHeader, bpmn:Message#property, bpmn:Message#zeebe:subscription#property, zeebe:taskDefinition, zeebe:calledElement, zeebe:linkedResource, zeebe:userTask, zeebe:formDefinition, zeebe:calledDecision, zeebe:script, zeebe:assignmentDefinition }"
153153
},
154154
{
155155
"path": [
@@ -215,10 +215,10 @@
215215
"allOf",
216216
4,
217217
"then",
218-
"allOf",
219-
0
218+
"properties",
219+
"properties"
220220
],
221-
"errorMessage": "When using \"zeebe:formDefinition\", \"zeebe:userTask\" must be set on the same element"
221+
"errorMessage": "When using \"zeebe:formDefinition\" or \"zeebe:assignmentDefinition\", \"zeebe:userTask\" must be set on the same element"
222222
},
223223
{
224224
"path": [
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
export const template = {
2+
name: 'AssignmentDefinition',
3+
id: 'com.camunda.example.AssignmentDefinition',
4+
appliesTo: [
5+
'bpmn:Task'
6+
],
7+
elementType: {
8+
value: 'bpmn:ServiceTask'
9+
},
10+
properties: [
11+
{
12+
type: 'Hidden',
13+
binding: {
14+
type: 'zeebe:userTask',
15+
}
16+
},
17+
{
18+
label: 'Assignee',
19+
description: 'Assignee for user task',
20+
type: 'String',
21+
binding: {
22+
type: 'zeebe:assignmentDefinition',
23+
property: 'assignee'
24+
}
25+
},
26+
{
27+
type: 'Text',
28+
binding: {
29+
type: 'zeebe:assignmentDefinition',
30+
property: 'candidateUsers'
31+
}
32+
},
33+
{
34+
type: 'Hidden',
35+
value: 'someDefaultGroup',
36+
binding: {
37+
type: 'zeebe:assignmentDefinition',
38+
property: 'candidateGroups'
39+
}
40+
}
41+
]
42+
};
43+
44+
// this is covered transitively by zeebe:userTask being a requirement for the assignmentDefinition binding
45+
export const errors = [
46+
{
47+
keyword: 'const',
48+
dataPath: '/elementType/value',
49+
schemaPath: '#/allOf/1/allOf/3/then/properties/elementType/properties/value/const',
50+
params: {
51+
allowedValue: 'bpmn:UserTask'
52+
},
53+
message: 'should be equal to constant'
54+
},
55+
{
56+
keyword: 'if',
57+
dataPath: '',
58+
schemaPath: '#/allOf/1/allOf/3/if',
59+
params: {
60+
failingKeyword: 'then'
61+
},
62+
message: 'should match "then" schema'
63+
},
64+
{
65+
keyword: 'type',
66+
dataPath: '',
67+
schemaPath: '#/oneOf/1/type',
68+
params: {
69+
type: 'array'
70+
},
71+
message: 'should be array'
72+
},
73+
{
74+
keyword: 'oneOf',
75+
dataPath: '',
76+
schemaPath: '#/oneOf',
77+
params: {
78+
passingSchemas: null
79+
},
80+
message: 'should match exactly one schema in oneOf'
81+
}
82+
];

0 commit comments

Comments
 (0)