Skip to content

Commit 690a331

Browse files
yT0n1Buckwich
authored andcommitted
feat: support zeebe:taskSchedule
Related to camunda/camunda-modeler#5093 Co-authored-by: Simon Steinrücken <[email protected]>
1 parent 5210a61 commit 690a331

16 files changed

+1270
-6
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
"zeebe:script",
6565
"zeebe:assignmentDefinition",
6666
"zeebe:priorityDefinition",
67-
"zeebe:adHoc"
67+
"zeebe:adHoc",
68+
"zeebe:taskSchedule"
6869
]
6970
}
7071
},
@@ -623,6 +624,9 @@
623624
},
624625
{
625626
"$ref": "./properties/adHoc.json"
627+
},
628+
{
629+
"$ref": "./properties/taskSchedule.json"
626630
}
627631
],
628632
"properties": {
@@ -845,6 +849,9 @@
845849
{
846850
"$ref": "./properties/binding/adHoc.json"
847851
},
852+
{
853+
"$ref": "./properties/binding/taskSchedule.json"
854+
},
848855
{
849856
"$ref": "examples.json#/binding"
850857
}
@@ -872,7 +879,8 @@
872879
"zeebe:script",
873880
"zeebe:assignmentDefinition",
874881
"zeebe:priorityDefinition",
875-
"zeebe:adHoc"
882+
"zeebe:adHoc",
883+
"zeebe:taskSchedule"
876884
]
877885
},
878886
"name": {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"if": {
3+
"properties": {
4+
"type": {
5+
"const": "zeebe:taskSchedule"
6+
}
7+
},
8+
"required": [
9+
"type"
10+
]
11+
},
12+
"then": {
13+
"properties": {
14+
"property": {
15+
"enum": [
16+
"dueDate",
17+
"followUpDate"
18+
]
19+
}
20+
},
21+
"required": [
22+
"property"
23+
]
24+
}
25+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"allOf": [
3+
{
4+
"if": {
5+
"properties": {
6+
"binding": {
7+
"properties": {
8+
"type": {
9+
"const": "zeebe:taskSchedule"
10+
},
11+
"property": {
12+
"enum": [
13+
"dueDate",
14+
"followUpDate"
15+
]
16+
}
17+
},
18+
"required": [
19+
"type",
20+
"property"
21+
]
22+
}
23+
},
24+
"required": [
25+
"binding"
26+
]
27+
},
28+
"then": {
29+
"required": [
30+
"type"
31+
],
32+
"properties": {
33+
"type": {
34+
"enum": [
35+
"Hidden",
36+
"String",
37+
"Dropdown",
38+
"Text"
39+
]
40+
}
41+
}
42+
}
43+
},
44+
{
45+
"if": {
46+
"properties": {
47+
"binding": {
48+
"properties": {
49+
"type": {
50+
"const": "zeebe:taskSchedule"
51+
},
52+
"property": {
53+
"enum": [
54+
"dueDate",
55+
"followUpDate"
56+
]
57+
}
58+
},
59+
"required": [
60+
"type",
61+
"property"
62+
]
63+
}
64+
65+
},
66+
"required": [
67+
"binding",
68+
"value"
69+
],
70+
"not": {
71+
"required": ["feel"]
72+
}
73+
},
74+
"then": {
75+
"properties": {
76+
"value": {
77+
"type": "string",
78+
"pattern": "^(?<date>\\d{4}-(?<month>0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]))T(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](Z|([+-](0[0-9]|1[0-3]):[0-5][0-9](\\[[^\\]]+\\])?))$",
79+
"description": "The value must be conforming to an ISO 8601 combined date and time representation."
80+
}
81+
},
82+
"required": [
83+
"value"
84+
]
85+
}
86+
}
87+
]
88+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@
301301
"enum": [
302302
"zeebe:formDefinition",
303303
"zeebe:assignmentDefinition",
304-
"zeebe:priorityDefinition"
304+
"zeebe:priorityDefinition",
305+
"zeebe:taskSchedule"
305306
]
306307
}
307308
},

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

Lines changed: 18 additions & 1 deletion
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, zeebe:assignmentDefinition, zeebe:priorityDefinition, zeebe:adHoc }"
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, zeebe:priorityDefinition, zeebe:adHoc, zeebe:taskSchedule }"
153153
},
154154
{
155155
"path": [
@@ -551,5 +551,22 @@
551551
2
552552
],
553553
"errorMessage": "When using \"zeebe:adHoc\" with properties \"outputCollection\" and \"outputElement\", \"zeebe:taskDefinition\" with property=\"type\" must be set on the same element"
554+
},
555+
{
556+
"path": [
557+
"definitions",
558+
"properties",
559+
"allOf",
560+
1,
561+
"items",
562+
"allOf",
563+
24,
564+
"allOf",
565+
1,
566+
"then",
567+
"properties",
568+
"value"
569+
],
570+
"errorMessage": "Must be conforming to an ISO 8601 combined date and time representation"
554571
}
555572
]

packages/zeebe-element-templates-json-schema/test/fixtures/invalid-binding-type.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,16 @@ export const errors = [
5454
'zeebe:script',
5555
'zeebe:assignmentDefinition',
5656
'zeebe:priorityDefinition',
57-
'zeebe:adHoc'
57+
'zeebe:adHoc',
58+
'zeebe:taskSchedule'
5859
]
5960
},
6061
message: 'should be equal to one of the allowed values',
6162
emUsed: true
6263
}
6364
]
6465
},
65-
message: 'invalid property.binding type "foo"; 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, zeebe:priorityDefinition, zeebe:adHoc }'
66+
message: 'invalid property.binding type "foo"; 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, zeebe:priorityDefinition, zeebe:adHoc, zeebe:taskSchedule }'
6667
},
6768
{
6869
keyword: 'type',
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
export const template = {
2+
'name': 'task schedule',
3+
'id': 'task-schedule-1',
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+
'type': 'Text',
19+
'binding': {
20+
'type': 'zeebe:taskSchedule',
21+
'property': 'dueDate'
22+
}
23+
},
24+
{
25+
'type': 'String',
26+
'binding': {
27+
'type': 'zeebe:taskSchedule',
28+
'property': 'followUpDate'
29+
}
30+
}
31+
]
32+
};
33+
34+
// This is caught transitively by requiring `zeebe:userTask`
35+
export const errors = [
36+
{
37+
keyword: 'const',
38+
dataPath: '/elementType/value',
39+
schemaPath: '#/allOf/1/allOf/3/then/properties/elementType/properties/value/const',
40+
params: {
41+
allowedValue: 'bpmn:UserTask'
42+
},
43+
message: 'should be equal to constant'
44+
},
45+
{
46+
keyword: 'if',
47+
dataPath: '',
48+
schemaPath: '#/allOf/1/allOf/3/if',
49+
params: {
50+
failingKeyword: 'then'
51+
},
52+
message: 'should match "then" schema'
53+
},
54+
{
55+
keyword: 'type',
56+
dataPath: '',
57+
schemaPath: '#/oneOf/1/type',
58+
params: {
59+
type: 'array'
60+
},
61+
message: 'should be array'
62+
},
63+
{
64+
keyword: 'oneOf',
65+
dataPath: '',
66+
schemaPath: '#/oneOf',
67+
params: {
68+
passingSchemas: null
69+
},
70+
message: 'should match exactly one schema in oneOf'
71+
}
72+
];

0 commit comments

Comments
 (0)