Skip to content

Commit

Permalink
feat: add zeebe:taskDefinition binding
Browse files Browse the repository at this point in the history
  • Loading branch information
barmac committed Oct 27, 2023
1 parent 3e6669f commit c1445b0
Show file tree
Hide file tree
Showing 6 changed files with 186 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
{
"type": "zeebe:taskHeader",
"key": "key"
},
{
"type": "zeebe:taskDefinition",
"property": "retries"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
"zeebe:taskDefinition:retries",
"zeebe:taskDefinition:type",
"bpmn:Message#property",
"bpmn:Message#zeebe:subscription#property"
"bpmn:Message#zeebe:subscription#property",
"zeebe:taskDefinition"
]
}
},
Expand Down Expand Up @@ -291,6 +292,23 @@
]
}
},
{
"if": {
"properties": {
"type": {
"const": "zeebe:taskDefinition"
}
},
"required": [
"type"
]
},
"then": {
"required": [
"property"
]
}
},
{
"$ref": "examples.json#/binding"
}
Expand All @@ -309,7 +327,8 @@
"zeebe:property",
"zeebe:taskHeader",
"bpmn:Message#property",
"bpmn:Message#zeebe:subscription#property"
"bpmn:Message#zeebe:subscription#property",
"zeebe:taskDefinition"
]
},
"name": {
Expand All @@ -326,6 +345,11 @@
"$id": "#/properties/property/binding/key",
"type": "string",
"description": "The key value of a property binding (zeebe:taskHeader)."
},
"property": {
"$id": "#/properties/property/binding/property",
"type": "string",
"description": "The name of the property defined in the binding."
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export const errors = [
'zeebe:property',
'zeebe:taskHeader',
'bpmn:Message#property',
'bpmn:Message#zeebe:subscription#property'
'bpmn:Message#zeebe:subscription#property',
'zeebe:taskDefinition'
]
},
message: 'should be equal to one of the allowed values'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
export const template = {
'name': 'InvalidZeebeTaskHeaderType',
'id': 'com.camunda.example.InvalidZeebeTaskHeaderType',
'appliesTo': [
'bpmn:Task'
],
'properties': [
{
'label': 'foo',
'type': 'Text',
'binding': {
'type': 'zeebe:taskDefinition'
}
},
{
'label': 'bar',
'type': 'Boolean',
'binding': {
'type': 'zeebe:taskDefinition'
}
}
]
};

export const errors = [
{
'dataPath': '/properties/0/binding',
'keyword': 'required',
'message': "should have required property 'property'",
'params': {
'missingProperty': 'property'
},
'schemaPath': '#/allOf/1/items/properties/binding/allOf/3/then/required'
},
{
'dataPath': '/properties/0/binding',
'keyword': 'if',
'message': 'should match "then" schema',
'params': {
'failingKeyword': 'then'
},
'schemaPath': '#/allOf/1/items/properties/binding/allOf/3/if'
},
{
keyword: 'errorMessage',
dataPath: '/properties/1/type',
schemaPath: '#/allOf/1/items/allOf/1/then/properties/type/errorMessage',
params: {
errors: [
{
keyword: 'enum',
emUsed: true,
dataPath: '/properties/1/type',
schemaPath: '#/allOf/1/items/allOf/1/then/properties/type/enum',
params: {
'allowedValues': [
'String',
'Text',
'Hidden',
'Dropdown'
]
},
message: 'should be equal to one of the allowed values'
}
]
},
message: 'invalid property type "Boolean" for binding type "zeebe:taskDefinition"; must be any of { String, Text, Hidden, Dropdown }'
},
{
keyword: 'if',
dataPath: '/properties/1',
schemaPath: '#/allOf/1/items/allOf/1/if',
params: {
'failingKeyword': 'then'
},
message: 'should match "then" schema'
},
{
'dataPath': '/properties/1/binding',
'keyword': 'required',
'message': "should have required property 'property'",
'params': {
'missingProperty': 'property'
},
'schemaPath': '#/allOf/1/items/properties/binding/allOf/3/then/required'
},
{
'dataPath': '/properties/1/binding',
'keyword': 'if',
'message': 'should match "then" schema',
'params': {
'failingKeyword': 'then'
},
'schemaPath': '#/allOf/1/items/properties/binding/allOf/3/if'
},
{
dataPath: '',
keyword: 'type',
message: 'should be array',
params: {
type: 'array',
},
schemaPath: '#/oneOf/1/type',
},
{
dataPath: '',
keyword: 'oneOf',
message: 'should match exactly one schema in oneOf',
params: {
passingSchemas: null
},
schemaPath: '#/oneOf'
}
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export const template = {
'name': 'InvalidZeebeTaskHeaderType',
'id': 'com.camunda.example.InvalidZeebeTaskHeaderType',
'appliesTo': [
'bpmn:Task'
],
'properties': [
{
'label': 'foo',
'type': 'Text',
'binding': {
'type': 'zeebe:taskDefinition',
'property': 'retries'
}
},
{
'label': 'bar',
'type': 'String',
'binding': {
'type': 'zeebe:taskDefinition',
'property': 'type'
}
}
]
};

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

testTemplate('invalid-zeebe-task-definition-type-type');


testTemplate('invalid-zeebe-task-definition');

});


Expand Down Expand Up @@ -336,6 +339,16 @@ describe('validation', function() {

});


describe('zeebe:taskDefinition', function() {


testTemplate('zeebe-task-definition');


testTemplate('invalid-zeebe-task-definition');

});
});

});
Expand Down

0 comments on commit c1445b0

Please sign in to comment.