Skip to content

Commit 876583e

Browse files
committed
fix: require linked resource to have proper binding type
1 parent 079ed02 commit 876583e

20 files changed

+1211
-115
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"enum": [
1313
"zeebe:calledDecision",
1414
"zeebe:formDefinition",
15-
"zeebe:calledElement"
15+
"zeebe:calledElement",
16+
"zeebe:linkedResource"
1617
]
1718
}
1819
},
@@ -74,7 +75,8 @@
7475
"enum": [
7576
"zeebe:calledDecision",
7677
"zeebe:formDefinition",
77-
"zeebe:calledElement"
78+
"zeebe:calledElement",
79+
"zeebe:linkedResource"
7880
]
7981
}
8082
},

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"enum": [
1616
"zeebe:calledDecision",
1717
"zeebe:formDefinition",
18-
"zeebe:calledElement"
18+
"zeebe:calledElement",
19+
"zeebe:linkedResource"
1920
]
2021
}
2122
},
@@ -50,7 +51,8 @@
5051
"enum": [
5152
"zeebe:calledDecision",
5253
"zeebe:formDefinition",
53-
"zeebe:calledElement"
54+
"zeebe:calledElement",
55+
"zeebe:linkedResource"
5456
]
5557
},
5658
"property": {
@@ -212,4 +214,4 @@
212214
}
213215
}
214216
]
215-
}
217+
}

packages/zeebe-element-templates-json-schema/test/fixtures/binding-type/called-element/missing-property-versionTag.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ export const errors = [
6262
allowedValues: [
6363
'zeebe:calledDecision',
6464
'zeebe:formDefinition',
65-
'zeebe:calledElement'
65+
'zeebe:calledElement',
66+
'zeebe:linkedResource'
6667
]
6768
},
6869
message: 'should be equal to one of the allowed values',

packages/zeebe-element-templates-json-schema/test/fixtures/binding-type/form-definition/missing-property-versionTag.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ export const errors = [
5959
allowedValues: [
6060
'zeebe:calledDecision',
6161
'zeebe:formDefinition',
62-
'zeebe:calledElement'
62+
'zeebe:calledElement',
63+
'zeebe:linkedResource'
6364
]
6465
},
6566
message: 'should be equal to one of the allowed values',
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export const template = {
2+
'$schema': 'https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json',
3+
'name': 'Form Definition with FormId',
4+
'id': 'formDefinitionWithFormId',
5+
'appliesTo': [
6+
'bpmn:Task'
7+
],
8+
'elementType': {
9+
'value': 'bpmn:ServiceTask'
10+
},
11+
'properties': [
12+
{
13+
'type': 'Hidden',
14+
'value': 'deployment',
15+
'binding': {
16+
'type': 'zeebe:linkedResource',
17+
'linkName': 'persistedLink',
18+
'property': 'bindingType'
19+
}
20+
}
21+
]
22+
};
23+
24+
export const errors = null;
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
export const template = {
2+
'$schema': 'https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json',
3+
'name': 'Form Definition with FormId',
4+
'id': 'formDefinitionWithFormId',
5+
'appliesTo': [
6+
'bpmn:Task'
7+
],
8+
'elementType': {
9+
'value': 'bpmn:ServiceTask'
10+
},
11+
'properties': [
12+
{
13+
'type': 'Dropdown',
14+
'label': 'Binding',
15+
'id': 'bindingType',
16+
'binding': {
17+
'type': 'zeebe:linkedResource',
18+
'linkName': 'persistedLink',
19+
'property': 'bindingType'
20+
},
21+
'choices': [
22+
{
23+
'name': 'Latest',
24+
'value': 'foo'
25+
},
26+
{
27+
'name': 'Deployment',
28+
'value': 'bar'
29+
},
30+
{
31+
'name': 'Version Tag',
32+
'value': 'baz'
33+
}
34+
],
35+
'value': 'latest',
36+
},
37+
{
38+
'type': 'String',
39+
'label': 'Version tag',
40+
'binding': {
41+
'type': 'zeebe:linkedResource',
42+
'linkName': 'persistedLink',
43+
'property': 'versionTag'
44+
},
45+
'condition': {
46+
'property': 'bindingType',
47+
'equals': 'versionTag'
48+
}
49+
}
50+
]
51+
};
52+
53+
export const errors = [
54+
{
55+
keyword: 'enum',
56+
dataPath: '/properties/0/choices/0/value',
57+
schemaPath: '#/allOf/1/items/allOf/20/allOf/0/then/properties/choices/items/properties/value/enum',
58+
params: {
59+
allowedValues: [
60+
'latest',
61+
'versionTag',
62+
'deployment'
63+
]
64+
},
65+
message: 'should be equal to one of the allowed values'
66+
},
67+
{
68+
keyword: 'enum',
69+
dataPath: '/properties/0/choices/1/value',
70+
schemaPath: '#/allOf/1/items/allOf/20/allOf/0/then/properties/choices/items/properties/value/enum',
71+
params: {
72+
allowedValues: [
73+
'latest',
74+
'versionTag',
75+
'deployment'
76+
]
77+
},
78+
message: 'should be equal to one of the allowed values'
79+
},
80+
{
81+
keyword: 'enum',
82+
dataPath: '/properties/0/choices/2/value',
83+
schemaPath: '#/allOf/1/items/allOf/20/allOf/0/then/properties/choices/items/properties/value/enum',
84+
params: {
85+
allowedValues: [
86+
'latest',
87+
'versionTag',
88+
'deployment'
89+
]
90+
},
91+
message: 'should be equal to one of the allowed values'
92+
},
93+
{
94+
keyword: 'if',
95+
dataPath: '/properties/0',
96+
schemaPath: '#/allOf/1/items/allOf/20/allOf/0/if',
97+
params: {
98+
failingKeyword: 'then'
99+
},
100+
message: 'should match "then" schema'
101+
},
102+
{
103+
keyword: 'type',
104+
dataPath: '',
105+
schemaPath: '#/oneOf/1/type',
106+
params: {
107+
type: 'array'
108+
},
109+
message: 'should be array'
110+
},
111+
{
112+
keyword: 'oneOf',
113+
dataPath: '',
114+
schemaPath: '#/oneOf',
115+
params: {
116+
passingSchemas: null
117+
},
118+
message: 'should match exactly one schema in oneOf'
119+
}
120+
];
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
export const template = {
2+
'$schema': 'https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json',
3+
'name': 'Form Definition with FormId',
4+
'id': 'formDefinitionWithFormId',
5+
'appliesTo': [
6+
'bpmn:Task'
7+
],
8+
'elementType': {
9+
'value': 'bpmn:ServiceTask'
10+
},
11+
'properties': [
12+
{
13+
'type': 'Dropdown',
14+
'label': 'Binding',
15+
'id': 'bindingType',
16+
'binding': {
17+
'type': 'zeebe:linkedResource',
18+
'linkName': 'persistedLink',
19+
'property': 'bindingType'
20+
},
21+
'choices': [
22+
{
23+
'name': 'Latest',
24+
'value': 'latest'
25+
},
26+
{
27+
'name': 'Deployment',
28+
'value': 'deployment'
29+
},
30+
{
31+
'name': 'Version Tag',
32+
'value': 'versionTag'
33+
}
34+
],
35+
'value': 'latest',
36+
},
37+
{
38+
'type': 'String',
39+
'label': 'Version tag',
40+
'binding': {
41+
'type': 'zeebe:linkedResource',
42+
'linkName': 'persistedLink',
43+
'property': 'versionTag'
44+
},
45+
'condition': {
46+
'property': 'bindingType',
47+
'equals': 'versionTag'
48+
}
49+
}
50+
]
51+
};
52+
53+
export const errors = null;

0 commit comments

Comments
 (0)