Skip to content

Commit e433ffb

Browse files
committed
feat: require feel for bpmn:Expression properties
Related to bpmn-io/bpmn-js-element-templates#161
1 parent f5d5f22 commit e433ffb

File tree

7 files changed

+490
-0
lines changed

7 files changed

+490
-0
lines changed
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
{
2+
"allOf": [
3+
{
4+
"if": {
5+
"anyOf": [
6+
{
7+
"required": [
8+
"elementType"
9+
],
10+
"properties": {
11+
"elementType": {
12+
"required": [
13+
"value"
14+
],
15+
"properties": {
16+
"value": {
17+
"const": "bpmn:AdHocSubProcess"
18+
}
19+
}
20+
}
21+
}
22+
},
23+
{
24+
"required": [
25+
"appliesTo"
26+
],
27+
"properties": {
28+
"appliesTo": {
29+
"const": [
30+
"bpmn:AdHocSubProcess"
31+
]
32+
}
33+
}
34+
}
35+
]
36+
},
37+
"then": {
38+
"properties": {
39+
"properties": {
40+
"items": {
41+
"if": {
42+
"properties": {
43+
"binding": {
44+
"properties": {
45+
"type": {
46+
"const": "property"
47+
},
48+
"name": {
49+
"const": "completionCondition"
50+
}
51+
},
52+
"required": [
53+
"type",
54+
"name"
55+
]
56+
}
57+
},
58+
"required": [
59+
"binding"
60+
]
61+
},
62+
"then": {
63+
"properties": {
64+
"feel": {
65+
"const": "required"
66+
}
67+
},
68+
"required": [
69+
"feel"
70+
]
71+
}
72+
}
73+
}
74+
}
75+
}
76+
},
77+
{
78+
"if": {
79+
"anyOf": [
80+
{
81+
"required": [
82+
"elementType"
83+
],
84+
"properties": {
85+
"elementType": {
86+
"required": [
87+
"value"
88+
],
89+
"properties": {
90+
"value": {
91+
"const": "bpmn:SequenceFlow"
92+
}
93+
}
94+
}
95+
}
96+
},
97+
{
98+
"required": [
99+
"appliesTo"
100+
],
101+
"properties": {
102+
"appliesTo": {
103+
"const": [
104+
"bpmn:SequenceFlow"
105+
]
106+
}
107+
}
108+
}
109+
]
110+
},
111+
"then": {
112+
"properties": {
113+
"properties": {
114+
"items": {
115+
"if": {
116+
"properties": {
117+
"binding": {
118+
"properties": {
119+
"type": {
120+
"const": "property"
121+
},
122+
"name": {
123+
"const": "conditionExpression"
124+
}
125+
},
126+
"required": [
127+
"type",
128+
"name"
129+
]
130+
}
131+
},
132+
"required": [
133+
"binding"
134+
]
135+
},
136+
"then": {
137+
"properties": {
138+
"feel": {
139+
"const": "required"
140+
}
141+
},
142+
"required": [
143+
"feel"
144+
]
145+
}
146+
}
147+
}
148+
}
149+
}
150+
},
151+
{
152+
"if": {
153+
"anyOf": [
154+
{
155+
"required": [
156+
"elementType"
157+
],
158+
"properties": {
159+
"elementType": {
160+
"required": [
161+
"value"
162+
],
163+
"properties": {
164+
"value": {
165+
"const": "bpmn:ComplexGateway"
166+
}
167+
}
168+
}
169+
}
170+
},
171+
{
172+
"required": [
173+
"appliesTo"
174+
],
175+
"properties": {
176+
"appliesTo": {
177+
"const": [
178+
"bpmn:ComplexGateway"
179+
]
180+
}
181+
}
182+
}
183+
]
184+
},
185+
"then": {
186+
"properties": {
187+
"properties": {
188+
"items": {
189+
"if": {
190+
"properties": {
191+
"binding": {
192+
"properties": {
193+
"type": {
194+
"const": "property"
195+
},
196+
"name": {
197+
"const": "activationCondition"
198+
}
199+
},
200+
"required": [
201+
"type",
202+
"name"
203+
]
204+
}
205+
},
206+
"required": [
207+
"binding"
208+
]
209+
},
210+
"then": {
211+
"properties": {
212+
"feel": {
213+
"const": "required"
214+
}
215+
},
216+
"required": [
217+
"feel"
218+
]
219+
}
220+
}
221+
}
222+
}
223+
}
224+
}
225+
]
226+
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
},
2222
{
2323
"$ref": "src/defs/template.json"
24+
},
25+
{
26+
"$ref": "src/defs/feel-required.json"
2427
}
2528
],
2629
"properties": {
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
export const template = {
2+
'name': 'Activation condition',
3+
'id': 'com.camunda.example.activationCondition',
4+
'appliesTo': [
5+
'bpmn:ComplexGateway',
6+
],
7+
'properties': [
8+
{
9+
'binding': {
10+
'type': 'property',
11+
'name': 'activationCondition'
12+
}
13+
}
14+
]
15+
};
16+
17+
export const errors = [
18+
{
19+
keyword: 'required',
20+
dataPath: '/properties/0',
21+
schemaPath: '#/allOf/2/allOf/2/then/properties/properties/items/then/required',
22+
params: {
23+
missingProperty: 'feel'
24+
},
25+
message: "should have required property 'feel'"
26+
},
27+
{
28+
keyword: 'if',
29+
dataPath: '/properties/0',
30+
schemaPath: '#/allOf/2/allOf/2/then/properties/properties/items/if',
31+
params: {
32+
failingKeyword: 'then'
33+
},
34+
message: 'should match "then" schema'
35+
},
36+
{
37+
keyword: 'if',
38+
dataPath: '',
39+
schemaPath: '#/allOf/2/allOf/2/if',
40+
params: {
41+
failingKeyword: 'then'
42+
},
43+
message: 'should match "then" schema'
44+
},
45+
{
46+
keyword: 'type',
47+
dataPath: '',
48+
schemaPath: '#/oneOf/1/type',
49+
params: {
50+
type: 'array'
51+
},
52+
message: 'should be array'
53+
},
54+
{
55+
keyword: 'oneOf',
56+
dataPath: '',
57+
schemaPath: '#/oneOf',
58+
params: {
59+
passingSchemas: null
60+
},
61+
message: 'should match exactly one schema in oneOf'
62+
}
63+
];
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
export const template = {
2+
'name': 'Completion condition',
3+
'id': 'com.camunda.example.completionCondition',
4+
'appliesTo': [
5+
'bpmn:AdHocSubProcess',
6+
],
7+
'properties': [
8+
{
9+
'binding': {
10+
'type': 'property',
11+
'name': 'completionCondition'
12+
}
13+
}
14+
]
15+
};
16+
17+
export const errors = [
18+
{
19+
keyword: 'required',
20+
dataPath: '/properties/0',
21+
schemaPath: '#/allOf/2/allOf/0/then/properties/properties/items/then/required',
22+
params: {
23+
missingProperty: 'feel'
24+
},
25+
message: "should have required property 'feel'"
26+
},
27+
{
28+
keyword: 'if',
29+
dataPath: '/properties/0',
30+
schemaPath: '#/allOf/2/allOf/0/then/properties/properties/items/if',
31+
params: {
32+
failingKeyword: 'then'
33+
},
34+
message: 'should match "then" schema'
35+
},
36+
{
37+
keyword: 'if',
38+
dataPath: '',
39+
schemaPath: '#/allOf/2/allOf/0/if',
40+
params: {
41+
failingKeyword: 'then'
42+
},
43+
message: 'should match "then" schema'
44+
},
45+
{
46+
keyword: 'type',
47+
dataPath: '',
48+
schemaPath: '#/oneOf/1/type',
49+
params: {
50+
type: 'array'
51+
},
52+
message: 'should be array'
53+
},
54+
{
55+
keyword: 'oneOf',
56+
dataPath: '',
57+
schemaPath: '#/oneOf',
58+
params: {
59+
passingSchemas: null
60+
},
61+
message: 'should match exactly one schema in oneOf'
62+
}
63+
];

0 commit comments

Comments
 (0)