Skip to content

Commit 6c9aeca

Browse files
committed
fix(zeebe): require feel for Boolean and Number inputs and outputs
Related to camunda/camunda-modeler#4593
1 parent 98b581a commit 6c9aeca

File tree

4 files changed

+345
-0
lines changed

4 files changed

+345
-0
lines changed

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,38 @@
316316
}
317317
}
318318
}
319+
},
320+
{
321+
"allOf": [
322+
{
323+
"if": {
324+
"properties": {
325+
"binding": {
326+
"properties": {
327+
"type": {
328+
"enum": ["zeebe:input", "zeebe:output"]
329+
}
330+
},
331+
"required": ["type"]
332+
},
333+
"type": {
334+
"enum": ["Boolean", "Number"]
335+
}
336+
},
337+
"required": ["binding", "type"]
338+
},
339+
"then": {
340+
"required": ["feel"],
341+
"properties": {
342+
"feel": {
343+
"const": "static"
344+
}
345+
}
346+
}
347+
}
348+
]
319349
}
350+
320351
],
321352
"properties": {
322353
"binding": {
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
export const template = {
2+
'name': 'InvalidZeebeInputFEEL',
3+
'id': 'com.camunda.example.InvalidZeebeInputFEEL',
4+
'appliesTo': [
5+
'bpmn:Task'
6+
],
7+
'properties': [
8+
{
9+
'label': 'booleanValid',
10+
'type': 'Boolean',
11+
'binding': {
12+
'type': 'zeebe:input',
13+
'name': 'booleanValid'
14+
},
15+
'feel': 'static'
16+
},
17+
{
18+
'label': 'numberValid',
19+
'type': 'Number',
20+
'binding': {
21+
'type': 'zeebe:input',
22+
'name': 'numberValid'
23+
},
24+
'feel': 'static'
25+
},
26+
{
27+
'label': 'booleanInvalid',
28+
'type': 'Boolean',
29+
'binding': {
30+
'type': 'zeebe:input',
31+
'name': 'booleanInvalid'
32+
}
33+
},
34+
{
35+
'label': 'numberInvalid',
36+
'type': 'Number',
37+
'binding': {
38+
'type': 'zeebe:input',
39+
'name': 'numberInvalid'
40+
}
41+
},
42+
{
43+
'label': 'booleanInvalidFeel',
44+
'type': 'Boolean',
45+
'binding': {
46+
'type': 'zeebe:input',
47+
'name': 'booleanInvalidFeel'
48+
},
49+
'feel': 'required'
50+
},
51+
{
52+
'label': 'numberInvalidFeel',
53+
'type': 'Number',
54+
'binding': {
55+
'type': 'zeebe:input',
56+
'name': 'numberInvalidFeel'
57+
},
58+
'feel': 'required'
59+
}
60+
]
61+
};
62+
63+
export const errors = [
64+
{
65+
'dataPath': '/properties/2',
66+
'keyword': 'required',
67+
'message': 'should have required property \'feel\'',
68+
'params': {
69+
'missingProperty': 'feel'
70+
},
71+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/required'
72+
},
73+
{
74+
'dataPath': '/properties/2',
75+
'keyword': 'if',
76+
'message': 'should match "then" schema',
77+
'params': {
78+
'failingKeyword': 'then'
79+
},
80+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/if'
81+
},
82+
{
83+
'dataPath': '/properties/3',
84+
'keyword': 'required',
85+
'message': 'should have required property \'feel\'',
86+
'params': {
87+
'missingProperty': 'feel'
88+
},
89+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/required'
90+
},
91+
{
92+
'dataPath': '/properties/3',
93+
'keyword': 'if',
94+
'message': 'should match "then" schema',
95+
'params': {
96+
'failingKeyword': 'then'
97+
},
98+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/if'
99+
},
100+
{
101+
'dataPath': '/properties/4/feel',
102+
'keyword': 'const',
103+
'message': 'should be equal to constant',
104+
'params': {
105+
'allowedValue': 'static'
106+
},
107+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/properties/feel/const'
108+
},
109+
{
110+
'dataPath': '/properties/4',
111+
'keyword': 'if',
112+
'message': 'should match "then" schema',
113+
'params': {
114+
'failingKeyword': 'then'
115+
},
116+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/if'
117+
},
118+
{
119+
'dataPath': '/properties/5/feel',
120+
'keyword': 'const',
121+
'message': 'should be equal to constant',
122+
'params': {
123+
'allowedValue': 'static'
124+
},
125+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/properties/feel/const'
126+
},
127+
{
128+
'dataPath': '/properties/5',
129+
'keyword': 'if',
130+
'message': 'should match "then" schema',
131+
'params': {
132+
'failingKeyword': 'then'
133+
},
134+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/if'
135+
},
136+
{
137+
'dataPath': '',
138+
'keyword': 'type',
139+
'message': 'should be array',
140+
'params': {
141+
'type': 'array'
142+
},
143+
'schemaPath': '#/oneOf/1/type'
144+
},
145+
{
146+
'dataPath': '',
147+
'keyword': 'oneOf',
148+
'message': 'should match exactly one schema in oneOf',
149+
'params': {
150+
'passingSchemas': null
151+
},
152+
'schemaPath': '#/oneOf'
153+
}
154+
];
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
export const template = {
2+
'name': 'InvalidZeebeOutputFEEL',
3+
'id': 'com.camunda.example.InvalidZeebeOutputFEEL',
4+
'appliesTo': [
5+
'bpmn:Task'
6+
],
7+
'properties': [
8+
{
9+
'label': 'booleanValid',
10+
'type': 'Boolean',
11+
'binding': {
12+
'type': 'zeebe:output',
13+
'source': 'booleanValid'
14+
},
15+
'feel': 'static'
16+
},
17+
{
18+
'label': 'numberValid',
19+
'type': 'Number',
20+
'binding': {
21+
'type': 'zeebe:output',
22+
'source': 'numberValid'
23+
},
24+
'feel': 'static'
25+
},
26+
{
27+
'label': 'booleanInvalid',
28+
'type': 'Boolean',
29+
'binding': {
30+
'type': 'zeebe:output',
31+
'source': 'booleanInvalid'
32+
}
33+
},
34+
{
35+
'label': 'numberInvalid',
36+
'type': 'Number',
37+
'binding': {
38+
'type': 'zeebe:output',
39+
'source': 'numberInvalid'
40+
}
41+
},
42+
{
43+
'label': 'booleanInvalidFeel',
44+
'type': 'Boolean',
45+
'binding': {
46+
'type': 'zeebe:output',
47+
'source': 'booleanInvalidFeel'
48+
},
49+
'feel': 'required'
50+
},
51+
{
52+
'label': 'numberInvalidFeel',
53+
'type': 'Number',
54+
'binding': {
55+
'type': 'zeebe:output',
56+
'source': 'numberInvalidFeel'
57+
},
58+
'feel': 'required'
59+
}
60+
]
61+
};
62+
63+
export const errors = [
64+
{
65+
'dataPath': '/properties/2',
66+
'keyword': 'required',
67+
'message': 'should have required property \'feel\'',
68+
'params': {
69+
'missingProperty': 'feel'
70+
},
71+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/required'
72+
},
73+
{
74+
'dataPath': '/properties/2',
75+
'keyword': 'if',
76+
'message': 'should match "then" schema',
77+
'params': {
78+
'failingKeyword': 'then'
79+
},
80+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/if'
81+
},
82+
{
83+
'dataPath': '/properties/3',
84+
'keyword': 'required',
85+
'message': 'should have required property \'feel\'',
86+
'params': {
87+
'missingProperty': 'feel'
88+
},
89+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/required'
90+
},
91+
{
92+
'dataPath': '/properties/3',
93+
'keyword': 'if',
94+
'message': 'should match "then" schema',
95+
'params': {
96+
'failingKeyword': 'then'
97+
},
98+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/if'
99+
},
100+
{
101+
'dataPath': '/properties/4/feel',
102+
'keyword': 'const',
103+
'message': 'should be equal to constant',
104+
'params': {
105+
'allowedValue': 'static'
106+
},
107+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/properties/feel/const'
108+
},
109+
{
110+
'dataPath': '/properties/4',
111+
'keyword': 'if',
112+
'message': 'should match "then" schema',
113+
'params': {
114+
'failingKeyword': 'then'
115+
},
116+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/if'
117+
},
118+
{
119+
'dataPath': '/properties/5/feel',
120+
'keyword': 'const',
121+
'message': 'should be equal to constant',
122+
'params': {
123+
'allowedValue': 'static'
124+
},
125+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/then/properties/feel/const'
126+
},
127+
{
128+
'dataPath': '/properties/5',
129+
'keyword': 'if',
130+
'message': 'should match "then" schema',
131+
'params': {
132+
'failingKeyword': 'then'
133+
},
134+
'schemaPath': '#/allOf/1/items/allOf/11/allOf/0/if'
135+
},
136+
{
137+
'dataPath': '',
138+
'keyword': 'type',
139+
'message': 'should be array',
140+
'params': {
141+
'type': 'array'
142+
},
143+
'schemaPath': '#/oneOf/1/type'
144+
},
145+
{
146+
'dataPath': '',
147+
'keyword': 'oneOf',
148+
'message': 'should match exactly one schema in oneOf',
149+
'params': {
150+
'passingSchemas': null
151+
},
152+
'schemaPath': '#/oneOf'
153+
}
154+
];

packages/zeebe-element-templates-json-schema/test/spec/validationSpec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ describe('validation', function() {
122122
it('missing-binding-zeebe-header-key');
123123

124124

125+
it('invalid-zeebe-input-feel');
126+
127+
128+
it('invalid-zeebe-output-feel');
129+
130+
125131
it('with-version');
126132

127133

0 commit comments

Comments
 (0)