Skip to content

Commit 1043cae

Browse files
authored
feat: add support for zeebe:priorityDefinition
Related to camunda/camunda-modeler#5092
1 parent 847a3bc commit 1043cae

16 files changed

+1139
-9
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
@@ -62,7 +62,8 @@
6262
"zeebe:formDefinition",
6363
"zeebe:calledDecision",
6464
"zeebe:script",
65-
"zeebe:assignmentDefinition"
65+
"zeebe:assignmentDefinition",
66+
"zeebe:priorityDefinition"
6667
]
6768
}
6869
},
@@ -615,6 +616,9 @@
615616
},
616617
{
617618
"$ref": "./properties/assignmentDefinition.json"
619+
},
620+
{
621+
"$ref": "./properties/priorityDefinition.json"
618622
}
619623
],
620624
"properties": {
@@ -831,6 +835,9 @@
831835
{
832836
"$ref": "./properties/binding/assignmentDefinition.json"
833837
},
838+
{
839+
"$ref": "./properties/binding/priorityDefinition.json"
840+
},
834841
{
835842
"$ref": "examples.json#/binding"
836843
}
@@ -856,7 +863,8 @@
856863
"zeebe:formDefinition",
857864
"zeebe:calledDecision",
858865
"zeebe:script",
859-
"zeebe:assignmentDefinition"
866+
"zeebe:assignmentDefinition",
867+
"zeebe:priorityDefinition"
860868
]
861869
},
862870
"name": {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"if": {
3+
"properties": {
4+
"type": {
5+
"const": "zeebe:priorityDefinition"
6+
}
7+
},
8+
"required": [
9+
"type"
10+
]
11+
},
12+
"then": {
13+
"properties": {
14+
"property": {
15+
"const": "priority"
16+
}
17+
},
18+
"required": [
19+
"property"
20+
]
21+
}
22+
}
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
{
2+
"allOf": [
3+
{
4+
"if": {
5+
"type": "object",
6+
"properties": {
7+
"binding": {
8+
"properties": {
9+
"type": {
10+
"const": "zeebe:priorityDefinition"
11+
},
12+
"property": {
13+
"const": "priority"
14+
}
15+
},
16+
"required": [
17+
"type",
18+
"property"
19+
]
20+
}
21+
},
22+
"required": [
23+
"binding"
24+
]
25+
},
26+
"then": {
27+
"anyOf": [
28+
{
29+
"required": [
30+
"type"
31+
],
32+
"properties": {
33+
"type": {
34+
"enum": [
35+
"Hidden",
36+
"Number",
37+
"Dropdown"
38+
]
39+
}
40+
}
41+
},
42+
{
43+
"required": [
44+
"type",
45+
"feel"
46+
],
47+
"properties": {
48+
"type": {
49+
"enum": [
50+
"String",
51+
"Text"
52+
]
53+
},
54+
"feel": {
55+
"const": "required"
56+
}
57+
}
58+
}
59+
]
60+
}
61+
},
62+
{
63+
"if": {
64+
"type": "object",
65+
"properties": {
66+
"type": {
67+
"const": "Number"
68+
},
69+
"binding": {
70+
"properties": {
71+
"type": {
72+
"const": "zeebe:priorityDefinition"
73+
},
74+
"property": {
75+
"const": "priority"
76+
}
77+
},
78+
"required": [
79+
"type",
80+
"property"
81+
]
82+
}
83+
},
84+
"required": [
85+
"binding",
86+
"value",
87+
"type"
88+
]
89+
},
90+
"then": {
91+
"properties": {
92+
"value": {
93+
"type": "integer",
94+
"minimum": 0,
95+
"maximum": 100
96+
}
97+
}
98+
}
99+
},
100+
{
101+
"if": {
102+
"type": "object",
103+
"properties": {
104+
"type": {
105+
"enum": [
106+
"Hidden",
107+
"Dropdown"
108+
]
109+
},
110+
"binding": {
111+
"properties": {
112+
"type": {
113+
"const": "zeebe:priorityDefinition"
114+
},
115+
"property": {
116+
"const": "priority"
117+
}
118+
},
119+
"required": [
120+
"type",
121+
"property"
122+
]
123+
}
124+
},
125+
"required": [
126+
"binding",
127+
"type"
128+
]
129+
},
130+
"then": {
131+
"properties": {
132+
"value": {
133+
"type": "string",
134+
"pattern": "^(100|[1-9]?[0-9])$"
135+
},
136+
"choices": {
137+
"items": {
138+
"properties": {
139+
"value": {
140+
"type": "string",
141+
"pattern": "^(100|[1-9]?[0-9])$"
142+
}
143+
}
144+
}
145+
}
146+
}
147+
}
148+
}
149+
]
150+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@
300300
"type": {
301301
"enum": [
302302
"zeebe:formDefinition",
303-
"zeebe:assignmentDefinition"
303+
"zeebe:assignmentDefinition",
304+
"zeebe:priorityDefinition"
304305
]
305306
}
306307
},

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

Lines changed: 39 additions & 2 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, zeebe:assignmentDefinition }"
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 }"
153153
},
154154
{
155155
"path": [
@@ -218,7 +218,7 @@
218218
"properties",
219219
"properties"
220220
],
221-
"errorMessage": "When using \"zeebe:formDefinition\" or \"zeebe:assignmentDefinition\", \"zeebe:userTask\" must be set on the same element"
221+
"errorMessage": "When using ${0/0/binding/type}, \"zeebe:userTask\" must be set on the same element"
222222
},
223223
{
224224
"path": [
@@ -444,5 +444,42 @@
444444
"properties"
445445
],
446446
"errorMessage": "\"formId\" and \"externalReference\" cannot be used together"
447+
},
448+
{
449+
"path": [
450+
"definitions",
451+
"properties",
452+
"allOf",
453+
1,
454+
"items",
455+
"allOf",
456+
22,
457+
"allOf",
458+
2,
459+
"then",
460+
"properties",
461+
"value"
462+
],
463+
"errorMessage": "Invalid value for priority. Must be between 0 and 100"
464+
},
465+
{
466+
"path": [
467+
"definitions",
468+
"properties",
469+
"allOf",
470+
1,
471+
"items",
472+
"allOf",
473+
22,
474+
"allOf",
475+
2,
476+
"then",
477+
"properties",
478+
"choices",
479+
"items",
480+
"properties",
481+
"value"
482+
],
483+
"errorMessage": "Invalid value for priority. Must be between 0 and 100"
447484
}
448485
]

packages/zeebe-element-templates-json-schema/test/fixtures/assignment-definition/missing-zeebe-user-task.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const errors = [
8484
}
8585
]
8686
},
87-
message: 'When using "zeebe:formDefinition" or "zeebe:assignmentDefinition", "zeebe:userTask" must be set on the same element'
87+
message: 'When using "zeebe:assignmentDefinition", "zeebe:userTask" must be set on the same element'
8888
},
8989
{
9090
keyword: 'if',

packages/zeebe-element-templates-json-schema/test/fixtures/form-definition-missing-zeebe-user-task.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const errors = [
4949
}
5050
]
5151
},
52-
message: 'When using "zeebe:formDefinition" or "zeebe:assignmentDefinition", "zeebe:userTask" must be set on the same element'
52+
message: 'When using "zeebe:formDefinition", "zeebe:userTask" must be set on the same element'
5353
},
5454
{
5555
keyword: 'if',

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
@@ -52,15 +52,16 @@ export const errors = [
5252
'zeebe:formDefinition',
5353
'zeebe:calledDecision',
5454
'zeebe:script',
55-
'zeebe:assignmentDefinition'
55+
'zeebe:assignmentDefinition',
56+
'zeebe:priorityDefinition'
5657
]
5758
},
5859
message: 'should be equal to one of the allowed values',
5960
emUsed: true
6061
}
6162
]
6263
},
63-
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 }'
64+
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 }'
6465
},
6566
{
6667
keyword: 'type',

0 commit comments

Comments
 (0)