Skip to content

Commit

Permalink
feat: support zeebe:calledElement templating
Browse files Browse the repository at this point in the history
  • Loading branch information
barmac committed Dec 4, 2023
1 parent 40e64e1 commit 2801a55
Show file tree
Hide file tree
Showing 11 changed files with 635 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
"zeebe:taskDefinition:type",
"bpmn:Message#property",
"bpmn:Message#zeebe:subscription#property",
"zeebe:taskDefinition"
"zeebe:taskDefinition",
"zeebe:calledElement"
]
}
},
Expand Down Expand Up @@ -331,6 +332,28 @@
"deprecated": true
}
},
{
"if": {
"properties": {
"type": {
"const": "zeebe:calledElement"
}
},
"required": [
"type"
]
},
"then": {
"properties": {
"property": {
"const": "processId"
}
},
"required": [
"property"
]
}
},
{
"$ref": "examples.json#/binding"
}
Expand All @@ -349,7 +372,8 @@
"zeebe:taskHeader",
"bpmn:Message#property",
"bpmn:Message#zeebe:subscription#property",
"zeebe:taskDefinition"
"zeebe:taskDefinition",
"zeebe:calledElement"
]
},
"name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,65 @@
}
}
}
},
{
"if": {
"properties": {
"properties": {
"contains": {
"properties": {
"binding": {
"properties": {
"type": {
"const": "zeebe:calledElement"
}
},
"required": [
"type"
]
}
},
"required": [
"binding"
]
}
}
},
"required": [
"properties"
]
},
"then":{
"anyOf": [
{
"required": [
"elementType"
],
"properties": {
"elementType": {
"required": [
"value"
],
"properties": {
"value": {
"const": "bpmn:CallActivity"
}
}
}
}
},
{
"required": [
"appliesTo"
],
"properties": {
"appliesTo": {
"const": [ "bpmn:CallActivity" ]
}
}
}
]
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
export const template = {
'$schema': 'https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json',
'id': 'io.camunda.examples.Payment',
'name': 'Payment',
'description': 'Payment process call activity',
'appliesTo': [
'bpmn:CallActivity'
],
'properties':[
{
'type': 'Hidden',
'value': 'paymentProcess',
'binding': {
'type': 'zeebe:calledElement',
'property': 'processId'
}
},
{
'label': 'Payment ID',
'type': 'String',
'binding': {
'type': 'zeebe:input',
'name': 'paymentID'
}
},
{
'label': 'Amount',
'type': 'String',
'binding': {
'type': 'zeebe:input',
'name': 'amount'
}
},
{
'label': 'Outcome',
'type': 'String',
'description': 'Name of variable to store the result data in.',
'value': 'paymentOutcome',
'binding': {
'type': 'zeebe:output',
'source': '=outcome'
}
}
]
};

export const errors = null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
export const template = {
'$schema': 'https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json',
'id': 'io.camunda.examples.Payment',
'name': 'Payment',
'description': 'Payment process call activity',
'appliesTo': [
'bpmn:Task'
],
'properties':[
{
'type': 'Hidden',
'value': 'paymentProcess',
'binding': {
'type': 'zeebe:calledElement',
'property': 'processId'
}
},
{
'label': 'Payment ID',
'type': 'String',
'binding': {
'type': 'zeebe:input',
'name': 'paymentID'
}
},
{
'label': 'Amount',
'type': 'String',
'binding': {
'type': 'zeebe:input',
'name': 'amount'
}
},
{
'label': 'Outcome',
'type': 'String',
'description': 'Name of variable to store the result data in.',
'value': 'paymentOutcome',
'binding': {
'type': 'zeebe:output',
'source': '=outcome'
}
}
]
};

export const errors = [
{
keyword: 'required',
dataPath: '',
schemaPath: '#/allOf/1/allOf/2/then/anyOf/0/required',
params: { missingProperty: 'elementType' },
message: "should have required property 'elementType'"
},
{
keyword: 'const',
dataPath: '/appliesTo',
schemaPath: '#/allOf/1/allOf/2/then/anyOf/1/properties/appliesTo/const',
params: { allowedValue: [ 'bpmn:CallActivity' ] },
message: 'should be equal to constant'
},
{
keyword: 'anyOf',
dataPath: '',
schemaPath: '#/allOf/1/allOf/2/then/anyOf',
params: {},
message: 'should match some schema in anyOf'
},
{
keyword: 'if',
dataPath: '',
schemaPath: '#/allOf/1/allOf/2/if',
params: { failingKeyword: 'then' },
message: 'should match "then" schema'
},
{
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,93 @@
export const template = {
'$schema': 'https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json',
'id': 'io.camunda.examples.Payment',
'name': 'Payment',
'description': 'Payment process call activity',
'appliesTo': [
'bpmn:Task'
],
'elementType': {
'value': 'bpmn:Task'
},
'properties':[
{
'type': 'Hidden',
'value': 'paymentProcess',
'binding': {
'type': 'zeebe:calledElement',
'property': 'processId'
}
},
{
'label': 'Payment ID',
'type': 'String',
'binding': {
'type': 'zeebe:input',
'name': 'paymentID'
}
},
{
'label': 'Amount',
'type': 'String',
'binding': {
'type': 'zeebe:input',
'name': 'amount'
}
},
{
'label': 'Outcome',
'type': 'String',
'description': 'Name of variable to store the result data in.',
'value': 'paymentOutcome',
'binding': {
'type': 'zeebe:output',
'source': '=outcome'
}
}
]
};

export const errors = [
{
keyword: 'const',
dataPath: '/elementType/value',
schemaPath: '#/allOf/1/allOf/2/then/anyOf/0/properties/elementType/properties/value/const',
params: { allowedValue: 'bpmn:CallActivity' },
message: 'should be equal to constant'
},
{
keyword: 'const',
dataPath: '/appliesTo',
schemaPath: '#/allOf/1/allOf/2/then/anyOf/1/properties/appliesTo/const',
params: { allowedValue: [ 'bpmn:CallActivity' ] },
message: 'should be equal to constant'
},
{
keyword: 'anyOf',
dataPath: '',
schemaPath: '#/allOf/1/allOf/2/then/anyOf',
params: {},
message: 'should match some schema in anyOf'
},
{
keyword: 'if',
dataPath: '',
schemaPath: '#/allOf/1/allOf/2/if',
params: { failingKeyword: 'then' },
message: 'should match "then" schema'
},
{
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'
}
];
Loading

0 comments on commit 2801a55

Please sign in to comment.