Skip to content

Commit 9d157e3

Browse files
jarekdanielaknikku
authored andcommitted
feat(zeebe): support engines property
`engines` is a new property that allows templates to declare compatibility with other run-time provided engines. Closes #146
1 parent 4216f8d commit 9d157e3

File tree

7 files changed

+142
-0
lines changed

7 files changed

+142
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$id": "#/engines",
3+
"type": "object",
4+
"description": "Defines the compatibility of this element template with different engines. Keys are engine names, values are semantic version ranges.",
5+
"default": {},
6+
"examples": [
7+
{
8+
"camunda": "^8.5"
9+
}
10+
],
11+
"properties": {
12+
"camunda": {
13+
"$id": "#/engines/camunda",
14+
"type": "string",
15+
"description": "A semantic version range that denotes compatible Camunda versions.",
16+
"default": ""
17+
}
18+
}
19+
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
"$ref": "#/definitions/properties",
2929
"$id": "#/properties"
3030
},
31+
"engines": {
32+
"$ref": "src/defs/engines.json"
33+
},
3134
"icon": {
3235
"$ref": "src/defs/icon.json"
3336
},
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
export const template = {
2+
'name': 'Engines Invalid Versions',
3+
'id': 'foo',
4+
'appliesTo': [
5+
'bpmn:Task'
6+
],
7+
'engines': {
8+
'camunda': [ '8.5' ],
9+
},
10+
'properties': [],
11+
};
12+
13+
export const errors = [
14+
{
15+
dataPath: '/engines/camunda',
16+
keyword: 'type',
17+
message: 'should be string',
18+
params: {
19+
type: 'string'
20+
},
21+
schemaPath: '#/properties/engines/properties/camunda/type'
22+
},
23+
{
24+
keyword: 'type',
25+
dataPath: '',
26+
schemaPath: '#/oneOf/1/type',
27+
params: {
28+
type: 'array'
29+
},
30+
message: 'should be array'
31+
},
32+
{
33+
keyword: 'oneOf',
34+
dataPath: '',
35+
schemaPath: '#/oneOf',
36+
params: {
37+
passingSchemas: null
38+
},
39+
message: 'should match exactly one schema in oneOf'
40+
}
41+
];
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
export const template = {
2+
'name': 'Engines Invalid',
3+
'id': 'foo',
4+
'appliesTo': [
5+
'bpmn:Task'
6+
],
7+
'engines': '8.5',
8+
'properties': [],
9+
};
10+
11+
export const errors = [
12+
{
13+
dataPath: '/engines',
14+
keyword: 'type',
15+
message: 'should be object',
16+
params: {
17+
type: 'object'
18+
},
19+
schemaPath: '#/properties/engines/type'
20+
},
21+
{
22+
keyword: 'type',
23+
dataPath: '',
24+
schemaPath: '#/oneOf/1/type',
25+
params: {
26+
type: 'array'
27+
},
28+
message: 'should be array'
29+
},
30+
{
31+
keyword: 'oneOf',
32+
dataPath: '',
33+
schemaPath: '#/oneOf',
34+
params: {
35+
passingSchemas: null
36+
},
37+
message: 'should match exactly one schema in oneOf'
38+
}
39+
];
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export const template = {
2+
'name': 'Engines Valid',
3+
'id': 'foo',
4+
'appliesTo': [
5+
'bpmn:Task'
6+
],
7+
'engines': {
8+
'other': '^1.3-beta.0'
9+
},
10+
'properties': []
11+
};
12+
13+
export const errors = null;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export const template = {
2+
'name': 'Engines Valid',
3+
'id': 'foo',
4+
'appliesTo': [
5+
'bpmn:Task'
6+
],
7+
'engines': {
8+
'camunda': '8.5',
9+
'other': '^1.3-beta.0'
10+
},
11+
'properties': [],
12+
};
13+
14+
export const errors = null;

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,19 @@ describe('validation', function() {
389389

390390
testTemplate('placeholder-invalid-type');
391391
});
392+
393+
394+
describe('engines', function() {
395+
396+
testTemplate('engines');
397+
398+
testTemplate('engines-no-camunda');
399+
400+
testTemplate('engines-invalid');
401+
402+
testTemplate('engines-invalid-version');
403+
});
404+
392405
});
393406

394407
});

0 commit comments

Comments
 (0)