Skip to content

Commit

Permalink
feat(zeebe): support engines property
Browse files Browse the repository at this point in the history
`engines` is a new property that allows templates to declare
compatibility with other run-time provided engines.

Closes #146
  • Loading branch information
jarekdanielak authored and nikku committed Dec 6, 2024
1 parent 4216f8d commit 9d157e3
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/zeebe-element-templates-json-schema/src/defs/engines.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$id": "#/engines",
"type": "object",
"description": "Defines the compatibility of this element template with different engines. Keys are engine names, values are semantic version ranges.",
"default": {},
"examples": [
{
"camunda": "^8.5"
}
],
"properties": {
"camunda": {
"$id": "#/engines/camunda",
"type": "string",
"description": "A semantic version range that denotes compatible Camunda versions.",
"default": ""
}
}
}
3 changes: 3 additions & 0 deletions packages/zeebe-element-templates-json-schema/src/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"$ref": "#/definitions/properties",
"$id": "#/properties"
},
"engines": {
"$ref": "src/defs/engines.json"
},
"icon": {
"$ref": "src/defs/icon.json"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
export const template = {
'name': 'Engines Invalid Versions',
'id': 'foo',
'appliesTo': [
'bpmn:Task'
],
'engines': {
'camunda': [ '8.5' ],
},
'properties': [],
};

export const errors = [
{
dataPath: '/engines/camunda',
keyword: 'type',
message: 'should be string',
params: {
type: 'string'
},
schemaPath: '#/properties/engines/properties/camunda/type'
},
{
keyword: 'type',
dataPath: '',
schemaPath: '#/oneOf/1/type',
params: {
type: 'array'
},
message: 'should be array'
},
{
keyword: 'oneOf',
dataPath: '',
schemaPath: '#/oneOf',
params: {
passingSchemas: null
},
message: 'should match exactly one schema in oneOf'
}
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export const template = {
'name': 'Engines Invalid',
'id': 'foo',
'appliesTo': [
'bpmn:Task'
],
'engines': '8.5',
'properties': [],
};

export const errors = [
{
dataPath: '/engines',
keyword: 'type',
message: 'should be object',
params: {
type: 'object'
},
schemaPath: '#/properties/engines/type'
},
{
keyword: 'type',
dataPath: '',
schemaPath: '#/oneOf/1/type',
params: {
type: 'array'
},
message: 'should be array'
},
{
keyword: 'oneOf',
dataPath: '',
schemaPath: '#/oneOf',
params: {
passingSchemas: null
},
message: 'should match exactly one schema in oneOf'
}
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const template = {
'name': 'Engines Valid',
'id': 'foo',
'appliesTo': [
'bpmn:Task'
],
'engines': {
'other': '^1.3-beta.0'
},
'properties': []
};

export const errors = null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const template = {
'name': 'Engines Valid',
'id': 'foo',
'appliesTo': [
'bpmn:Task'
],
'engines': {
'camunda': '8.5',
'other': '^1.3-beta.0'
},
'properties': [],
};

export const errors = null;
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,19 @@ describe('validation', function() {

testTemplate('placeholder-invalid-type');
});


describe('engines', function() {

testTemplate('engines');

testTemplate('engines-no-camunda');

testTemplate('engines-invalid');

testTemplate('engines-invalid-version');
});

});

});
Expand Down

0 comments on commit 9d157e3

Please sign in to comment.