Skip to content

Commit 0fd78fb

Browse files
committed
feat(zeebe): add zeebe:LinkedResource
1 parent 7408b80 commit 0fd78fb

File tree

8 files changed

+284
-5
lines changed

8 files changed

+284
-5
lines changed

packages/zeebe-element-templates-json-schema/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ All notable changes to [@camunda/zeebe-element-templates-json-schema](https://gi
66

77
___Note:__ Yet to be released changes appear here._
88

9+
* `FEAT`: support `zeebe:linkedResource` binding
10+
911
## 0.21.0
1012

1113
* `FEAT`: support `engines` field ([#146](https://github.com/camunda/element-templates-json-schema/issues/146))

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

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
"bpmn:Message#property",
5858
"bpmn:Message#zeebe:subscription#property",
5959
"zeebe:taskDefinition",
60-
"zeebe:calledElement"
60+
"zeebe:calledElement",
61+
"zeebe:linkedResource"
6162
]
6263
}
6364
},
@@ -273,6 +274,48 @@
273274
}
274275
}
275276
}
277+
},
278+
{
279+
"if": {
280+
"properties": {
281+
"binding": {
282+
"properties": {
283+
"type": {
284+
"const": "zeebe:linkedResource"
285+
}
286+
},
287+
"required": [
288+
"type"
289+
]
290+
}
291+
},
292+
"required": [
293+
"binding"
294+
]
295+
},
296+
"then": {
297+
"properties": {
298+
"binding": {
299+
"properties": {
300+
"linkName": {
301+
"type": "string"
302+
},
303+
"property": {
304+
"enum": [
305+
"resourceId",
306+
"resourceType",
307+
"bindingType",
308+
"versionTag"
309+
]
310+
}
311+
},
312+
"required": [
313+
"linkName",
314+
"property"
315+
]
316+
}
317+
}
318+
}
276319
}
277320
],
278321
"properties": {
@@ -422,7 +465,8 @@
422465
"bpmn:Message#property",
423466
"bpmn:Message#zeebe:subscription#property",
424467
"zeebe:taskDefinition",
425-
"zeebe:calledElement"
468+
"zeebe:calledElement",
469+
"zeebe:linkedResource"
426470
]
427471
},
428472
"name": {
@@ -444,6 +488,11 @@
444488
"$id": "#/properties/property/binding/property",
445489
"type": "string",
446490
"description": "The name of the property defined in the binding."
491+
},
492+
"linkName": {
493+
"$id": "#/properties/property/binding/linkName",
494+
"type": "string",
495+
"description": "The `linkName` of the element (zeebe:linkedResource)."
447496
}
448497
}
449498
},

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

Lines changed: 18 additions & 1 deletion
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 }"
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 }"
153153
},
154154
{
155155
"path": [
@@ -176,5 +176,22 @@
176176
"contents": "missing icon contents"
177177
}
178178
}
179+
},
180+
{
181+
"path": [
182+
"definitions",
183+
"properties",
184+
"allOf",
185+
1,
186+
"items",
187+
"allOf",
188+
10,
189+
"then",
190+
"properties",
191+
"binding",
192+
"properties",
193+
"property"
194+
],
195+
"errorMessage": "invalid binding.property ${0}; must be any of { resourceId, resourceType, bindingType, versionTag }"
179196
}
180197
]

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
@@ -47,14 +47,15 @@ export const errors = [
4747
'bpmn:Message#property',
4848
'bpmn:Message#zeebe:subscription#property',
4949
'zeebe:taskDefinition',
50-
'zeebe:calledElement'
50+
'zeebe:calledElement',
51+
'zeebe:linkedResource'
5152
]
5253
},
5354
message: 'should be equal to one of the allowed values'
5455
}
5556
]
5657
},
57-
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 }'
58+
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 }'
5859
},
5960
{
6061
dataPath: '',
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
export const template = {
2+
'$schema': 'https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json',
3+
'name': 'linkedResource',
4+
'id': 'linkedResource',
5+
'version': 1,
6+
'appliesTo': [
7+
'bpmn:Task'
8+
],
9+
'elementType': {
10+
'value': 'bpmn:ServiceTask'
11+
},
12+
'properties': [
13+
{
14+
'type': 'String',
15+
'binding': {
16+
'type': 'zeebe:linkedResource',
17+
'linkName': 'myLink',
18+
'property': 'invalidProperty'
19+
}
20+
}
21+
]
22+
};
23+
24+
export const errors = [
25+
{
26+
'dataPath': '/properties/0/binding/property',
27+
'keyword': 'errorMessage',
28+
'message': 'invalid binding.property "invalidProperty"; must be any of { resourceId, resourceType, bindingType, versionTag }',
29+
'params': {
30+
'errors': [
31+
{
32+
'dataPath': '/properties/0/binding/property',
33+
'emUsed': true,
34+
'keyword': 'enum',
35+
'message': 'should be equal to one of the allowed values',
36+
'params': {
37+
'allowedValues': [
38+
'resourceId',
39+
'resourceType',
40+
'bindingType',
41+
'versionTag'
42+
],
43+
},
44+
'schemaPath': '#/allOf/1/items/allOf/10/then/properties/binding/properties/property/enum'
45+
},
46+
],
47+
},
48+
'schemaPath': '#/allOf/1/items/allOf/10/then/properties/binding/properties/property/errorMessage'
49+
},
50+
{
51+
'dataPath': '/properties/0',
52+
'keyword': 'if',
53+
'message': 'should match "then" schema',
54+
'params': {
55+
'failingKeyword': 'then',
56+
},
57+
'schemaPath': '#/allOf/1/items/allOf/10/if',
58+
},
59+
{
60+
'dataPath': '',
61+
'keyword': 'type',
62+
'message': 'should be array',
63+
'params': {
64+
'type': 'array',
65+
},
66+
'schemaPath': '#/oneOf/1/type',
67+
},
68+
{
69+
'dataPath': '',
70+
'keyword': 'oneOf',
71+
'message': 'should match exactly one schema in oneOf',
72+
'params': {
73+
'passingSchemas': null,
74+
},
75+
'schemaPath': '#/oneOf',
76+
}
77+
];
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
export const template = {
2+
'$schema': 'https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json',
3+
'name': 'linkedResource',
4+
'id': 'linkedResource',
5+
'version': 1,
6+
'appliesTo': [
7+
'bpmn:Task'
8+
],
9+
'elementType': {
10+
'value': 'bpmn:ServiceTask'
11+
},
12+
'properties': [
13+
{
14+
'type': 'String',
15+
'value': 'RPA',
16+
'binding': {
17+
'type': 'zeebe:linkedResource',
18+
'property': 'resourceType'
19+
}
20+
}
21+
]
22+
};
23+
24+
export const errors = [
25+
{
26+
'dataPath': '/properties/0/binding',
27+
'keyword': 'required',
28+
'message': "should have required property 'linkName'",
29+
'params': {
30+
'missingProperty': 'linkName',
31+
},
32+
'schemaPath': '#/allOf/1/items/allOf/10/then/properties/binding/required'
33+
},
34+
{
35+
'dataPath': '/properties/0',
36+
'keyword': 'if',
37+
'message': 'should match "then" schema',
38+
'params': {
39+
'failingKeyword': 'then',
40+
},
41+
'schemaPath': '#/allOf/1/items/allOf/10/if'
42+
},
43+
{
44+
'dataPath': '',
45+
'keyword': 'type',
46+
'message': 'should be array',
47+
'params': {
48+
'type': 'array',
49+
},
50+
'schemaPath': '#/oneOf/1/type'
51+
},
52+
{
53+
'dataPath': '',
54+
'keyword': 'oneOf',
55+
'message': 'should match exactly one schema in oneOf',
56+
'params': {
57+
'passingSchemas': null,
58+
},
59+
'schemaPath': '#/oneOf'
60+
}
61+
];
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
export const template = {
2+
'$schema': 'https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json',
3+
'name': 'linkedResource',
4+
'id': 'linkedResource',
5+
'version': 1,
6+
'appliesTo': [
7+
'bpmn:Task'
8+
],
9+
'elementType': {
10+
'value': 'bpmn:ServiceTask'
11+
},
12+
'properties': [
13+
{
14+
'type': 'String',
15+
'value': 'RPA',
16+
'binding': {
17+
'type': 'zeebe:linkedResource',
18+
'linkName': 'persistedLink',
19+
'property': 'resourceType'
20+
}
21+
},
22+
{
23+
'type': 'String',
24+
'feel': 'optional',
25+
'binding': {
26+
'type': 'zeebe:linkedResource',
27+
'linkName': 'persistedLink',
28+
'property': 'resourceId'
29+
}
30+
},
31+
{
32+
'type': 'String',
33+
'value': 'versionTag',
34+
'binding': {
35+
'type': 'zeebe:linkedResource',
36+
'linkName': 'persistedLink',
37+
'property': 'bindingType'
38+
}
39+
},
40+
{
41+
'type': 'String',
42+
'value': 'v123',
43+
'binding': {
44+
'type': 'zeebe:linkedResource',
45+
'linkName': 'persistedLink',
46+
'property': 'versionTag'
47+
}
48+
},
49+
{
50+
'type': 'String',
51+
'value': 'RPA',
52+
'binding': {
53+
'type': 'zeebe:linkedResource',
54+
'linkName': 'removedLink',
55+
'property': 'resourceType'
56+
}
57+
}
58+
]
59+
};
60+
61+
export const errors = null;

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,17 @@ describe('validation', function() {
391391
});
392392

393393

394+
describe('zeebe:linkedResource', function() {
395+
396+
it('linked-resource');
397+
398+
it('linked-resource-invalid-property');
399+
400+
it('linked-resource-missing-linkName');
401+
402+
});
403+
404+
394405
describe('placeholder', function() {
395406

396407
it('placeholder');

0 commit comments

Comments
 (0)