Skip to content

Commit f9699f4

Browse files
yT0n1barmac
authored andcommitted
fix: don't complain about incorrect binding type
Related to #176 (comment)
1 parent e433ffb commit f9699f4

8 files changed

+254
-140
lines changed

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

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,9 @@
426426
}
427427
},
428428
{
429-
"not": {
429+
"properties": {
430430
"properties": {
431-
"properties": {
431+
"not": {
432432
"contains": {
433433
"properties": {
434434
"binding": {
@@ -450,15 +450,12 @@
450450
]
451451
}
452452
}
453-
},
454-
"required": [
455-
"properties"
456-
]
457-
}
453+
}
454+
},
455+
"required": [
456+
"properties"
457+
]
458458
}
459-
],
460-
"required": [
461-
"properties"
462459
]
463460
}
464461
},
@@ -569,9 +566,9 @@
569566
}
570567
},
571568
{
572-
"not": {
569+
"properties": {
573570
"properties": {
574-
"properties": {
571+
"not": {
575572
"contains": {
576573
"properties": {
577574
"binding": {
@@ -593,15 +590,12 @@
593590
]
594591
}
595592
}
596-
},
597-
"required": [
598-
"properties"
599-
]
600-
}
593+
}
594+
},
595+
"required": [
596+
"properties"
597+
]
601598
}
602-
],
603-
"required": [
604-
"properties"
605599
]
606600
}
607601
}

packages/zeebe-element-templates-json-schema/test/fixtures/business-rule-task-conflicting-bindings.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -44,48 +44,48 @@ export const template = {
4444

4545
export const errors = [
4646
{
47-
'keyword': 'errorMessage',
48-
'dataPath': '',
49-
'schemaPath': '#/allOf/1/allOf/5/then/allOf/2/errorMessage',
50-
'params': {
51-
'errors': [
47+
keyword: 'errorMessage',
48+
dataPath: '',
49+
schemaPath: '#/allOf/1/allOf/5/then/allOf/2/errorMessage',
50+
params: {
51+
errors: [
5252
{
53-
'keyword': 'not',
54-
'dataPath': '',
55-
'schemaPath': '#/allOf/1/allOf/5/then/allOf/2/not',
56-
'params': {},
57-
'message': 'should NOT be valid',
58-
'emUsed': true
53+
keyword: 'not',
54+
dataPath: '/properties',
55+
schemaPath: '#/allOf/1/allOf/5/then/allOf/2/properties/properties/not',
56+
params: {},
57+
message: 'should NOT be valid',
58+
emUsed: true
5959
}
6060
]
6161
},
62-
'message': 'Binding type "zeebe:taskDefinition" or "zeebe:taskDefinition:type" cannot be set when binding type "zeebe:calledDecision" is set.'
62+
message: 'Binding type "zeebe:taskDefinition" or "zeebe:taskDefinition:type" cannot be set when binding type "zeebe:calledDecision" is set.'
6363
},
6464
{
65-
'keyword': 'if',
66-
'dataPath': '',
67-
'schemaPath': '#/allOf/1/allOf/5/if',
68-
'params': {
69-
'failingKeyword': 'then'
65+
keyword: 'if',
66+
dataPath: '',
67+
schemaPath: '#/allOf/1/allOf/5/if',
68+
params: {
69+
failingKeyword: 'then'
7070
},
71-
'message': 'should match "then" schema'
71+
message: 'should match "then" schema'
7272
},
7373
{
74-
'keyword': 'type',
75-
'dataPath': '',
76-
'schemaPath': '#/oneOf/1/type',
77-
'params': {
78-
'type': 'array'
74+
keyword: 'type',
75+
dataPath: '',
76+
schemaPath: '#/oneOf/1/type',
77+
params: {
78+
type: 'array'
7979
},
80-
'message': 'should be array'
80+
message: 'should be array'
8181
},
8282
{
83-
'keyword': 'oneOf',
84-
'dataPath': '',
85-
'schemaPath': '#/oneOf',
86-
'params': {
87-
'passingSchemas': null
83+
keyword: 'oneOf',
84+
dataPath: '',
85+
schemaPath: '#/oneOf',
86+
params: {
87+
passingSchemas: null
8888
},
89-
'message': 'should match exactly one schema in oneOf'
89+
message: 'should match exactly one schema in oneOf'
9090
}
9191
];

packages/zeebe-element-templates-json-schema/test/fixtures/business-rule-task-conflicting-deprecated-bindings.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -43,48 +43,48 @@ export const template = {
4343

4444
export const errors = [
4545
{
46-
'keyword': 'errorMessage',
47-
'dataPath': '',
48-
'schemaPath': '#/allOf/1/allOf/5/then/allOf/2/errorMessage',
49-
'params': {
50-
'errors': [
46+
keyword: 'errorMessage',
47+
dataPath: '',
48+
schemaPath: '#/allOf/1/allOf/5/then/allOf/2/errorMessage',
49+
params: {
50+
errors: [
5151
{
52-
'keyword': 'not',
53-
'dataPath': '',
54-
'schemaPath': '#/allOf/1/allOf/5/then/allOf/2/not',
55-
'params': {},
56-
'message': 'should NOT be valid',
57-
'emUsed': true
52+
keyword: 'not',
53+
dataPath: '/properties',
54+
schemaPath: '#/allOf/1/allOf/5/then/allOf/2/properties/properties/not',
55+
params: {},
56+
message: 'should NOT be valid',
57+
emUsed: true
5858
}
5959
]
6060
},
61-
'message': 'Binding type "zeebe:taskDefinition" or "zeebe:taskDefinition:type" cannot be set when binding type "zeebe:calledDecision" is set.'
61+
message: 'Binding type "zeebe:taskDefinition" or "zeebe:taskDefinition:type" cannot be set when binding type "zeebe:calledDecision" is set.'
6262
},
6363
{
64-
'keyword': 'if',
65-
'dataPath': '',
66-
'schemaPath': '#/allOf/1/allOf/5/if',
67-
'params': {
68-
'failingKeyword': 'then'
64+
keyword: 'if',
65+
dataPath: '',
66+
schemaPath: '#/allOf/1/allOf/5/if',
67+
params: {
68+
failingKeyword: 'then'
6969
},
70-
'message': 'should match "then" schema'
70+
message: 'should match "then" schema'
7171
},
7272
{
73-
'keyword': 'type',
74-
'dataPath': '',
75-
'schemaPath': '#/oneOf/1/type',
76-
'params': {
77-
'type': 'array'
73+
keyword: 'type',
74+
dataPath: '',
75+
schemaPath: '#/oneOf/1/type',
76+
params: {
77+
type: 'array'
7878
},
79-
'message': 'should be array'
79+
message: 'should be array'
8080
},
8181
{
82-
'keyword': 'oneOf',
83-
'dataPath': '',
84-
'schemaPath': '#/oneOf',
85-
'params': {
86-
'passingSchemas': null
82+
keyword: 'oneOf',
83+
dataPath: '',
84+
schemaPath: '#/oneOf',
85+
params: {
86+
passingSchemas: null
8787
},
88-
'message': 'should match exactly one schema in oneOf'
88+
message: 'should match exactly one schema in oneOf'
8989
}
9090
];
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
export const template = [
2+
{
3+
name: 'Pattern Template',
4+
id: 'com.example.PatternTemplate',
5+
appliesTo: [
6+
'bpmn:Task'
7+
],
8+
properties: [
9+
{
10+
label: 'Text (static)',
11+
binding: {
12+
type: 'property',
13+
name: 'prop'
14+
},
15+
feel: 'required'
16+
}
17+
]
18+
}
19+
];
20+
21+
export const errors = [
22+
{
23+
keyword: 'type',
24+
dataPath: '',
25+
schemaPath: '#/type',
26+
params: {
27+
type: 'object'
28+
},
29+
message: 'should be object'
30+
},
31+
{
32+
keyword: 'required',
33+
dataPath: '/0/properties/0',
34+
schemaPath: '#/allOf/1/items/allOf/4/then/required',
35+
params: {
36+
missingProperty: 'type'
37+
},
38+
message: "should have required property 'type'"
39+
},
40+
{
41+
keyword: 'if',
42+
dataPath: '/0/properties/0',
43+
schemaPath: '#/allOf/1/items/allOf/4/if',
44+
params: {
45+
failingKeyword: 'then'
46+
},
47+
message: 'should match "then" schema'
48+
},
49+
{
50+
keyword: 'oneOf',
51+
dataPath: '',
52+
schemaPath: '#/oneOf',
53+
params: {
54+
passingSchemas: null
55+
},
56+
message: 'should match exactly one schema in oneOf'
57+
}
58+
];
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
export const template = {
2+
name: 'Pattern Template',
3+
id: 'com.example.PatternTemplate',
4+
appliesTo: [
5+
'bpmn:Task'
6+
],
7+
properties: [
8+
{
9+
label: 'Text (static)',
10+
binding: {
11+
type: 'property',
12+
name: 'prop'
13+
},
14+
feel: 'required'
15+
}
16+
]
17+
};
18+
19+
export const errors = [
20+
{
21+
keyword: 'required',
22+
dataPath: '/properties/0',
23+
schemaPath: '#/allOf/1/items/allOf/4/then/required',
24+
params: {
25+
missingProperty: 'type'
26+
},
27+
message: "should have required property 'type'"
28+
},
29+
{
30+
keyword: 'if',
31+
dataPath: '/properties/0',
32+
schemaPath: '#/allOf/1/items/allOf/4/if',
33+
params: {
34+
failingKeyword: 'then'
35+
},
36+
message: 'should match "then" schema'
37+
},
38+
{
39+
keyword: 'type',
40+
dataPath: '',
41+
schemaPath: '#/oneOf/1/type',
42+
params: {
43+
type: 'array'
44+
},
45+
message: 'should be array'
46+
},
47+
{
48+
keyword: 'oneOf',
49+
dataPath: '',
50+
schemaPath: '#/oneOf',
51+
params: {
52+
passingSchemas: null
53+
},
54+
message: 'should match exactly one schema in oneOf'
55+
}
56+
];

0 commit comments

Comments
 (0)