Skip to content

Commit

Permalink
feat: support engines property
Browse files Browse the repository at this point in the history
  • Loading branch information
jarekdanielak committed Nov 28, 2024
1 parent 4216f8d commit 26a2f9e
Show file tree
Hide file tree
Showing 6 changed files with 125 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": "List of engines and their versions compatible with this version of the template.",
"default": {},
"examples": [
{
"camunda": "*"
}
],
"properties": {
"camunda": {
"$id": "#/engines/camunda",
"type": "string",
"description": "List of compatible Camunda 8 versions. Use semantic versioning. You can skip patch 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': {
'camunda': '8.5'
},
'properties': [],
};

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

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


describe('engines', function() {

testTemplate('engines');

testTemplate('engines-invalid');

testTemplate('engines-invalid-version', null, true);
});
});

});
Expand Down

0 comments on commit 26a2f9e

Please sign in to comment.