Skip to content

Commit

Permalink
fix!: disallow subscription binding for bpmn:SendTask
Browse files Browse the repository at this point in the history
BREAKING CHANGE: the `bpmn:Message#zeebe:subscription#property` binding is not allowed for `bpmn:SendTask` anymore
  • Loading branch information
barmac committed Nov 24, 2023
1 parent 09f6e2a commit d134b5c
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 6 deletions.
8 changes: 8 additions & 0 deletions packages/zeebe-element-templates-json-schema/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ All notable changes to [@camunda/zeebe-element-templates-json-schema](https://gi

___Note:__ Yet to be released changes appear here._

## 0.17.0

* `FIX`: disallow `bpmn:Message#zeebe:subscription#property` binding for `bpmn:SendTask`

### Breaking Changes

* The `bpmn:Message#zeebe:subscription#property` binding is not allowed for `bpmn:SendTask` anymore. Remove the usage as the property is incorrect even if used in a template.

## 0.16.0

* `FEAT`: support `isActive` condition ([#120](https://github.com/camunda/element-templates-json-schema/pull/120))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,87 @@
"binding": {
"properties": {
"type": {
"const": "bpmn:Message#property"
}
},
"required": [
"type"
]
}
},
"required": [
"binding"
]
}
}
},
"required": [
"properties"
]
},
"then": {
"required": [
"elementType"
],
"properties": {
"elementType": {
"required": [
"value"
],
"properties": {
"value": {
"enum": [
"bpmn:ReceiveTask",
"bpmn:SendTask",
"bpmn:StartEvent",
"bpmn:IntermediateCatchEvent",
"bpmn:IntermediateThrowEvent",
"bpmn:BoundaryEvent",
"bpmn:EndEvent"
]
}
},
"allOf": [
{
"if": {
"properties": {
"value": {
"enum": [
"bpmn:Message#property",
"bpmn:Message#zeebe:subscription#property"
"bpmn:StartEvent",
"bpmn:IntermediateCatchEvent",
"bpmn:IntermediateThrowEvent",
"bpmn:BoundaryEvent",
"bpmn:EndEvent"

]
}
}
},
"then": {
"eventDefinition": {
"const": "bpmn:MessageEventDefinition"
},
"required": [
"eventDefinition"
]
}
}
]
}
}
}
},
{
"if": {
"properties": {
"properties": {
"contains": {
"properties": {
"binding": {
"properties": {
"type": {
"const": "bpmn:Message#zeebe:subscription#property"
}
},
"required": [
"type"
Expand Down Expand Up @@ -43,7 +119,6 @@
"value": {
"enum": [
"bpmn:ReceiveTask",
"bpmn:SendTask",
"bpmn:StartEvent",
"bpmn:IntermediateCatchEvent",
"bpmn:IntermediateThrowEvent",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
export const template = {
'name': 'InvalidElementType',
'id': 'com.camunda.example.InvalidElementType',
'appliesTo': [
'bpmn:Task'
],
'elementType': {
value: 'bpmn:SendTask'
},
'properties': [
{
'label': 'foo',
'type': 'String',
'binding': {
'type': 'bpmn:Message#zeebe:subscription#property',
'name': 'correlationKey'
}
}
]
};

export const errors = [
{
dataPath: '/elementType/value',
keyword: 'enum',
schemaPath: '#/allOf/1/allOf/1/then/properties/elementType/properties/value/enum',
params: {
'allowedValues': [
'bpmn:ReceiveTask',
'bpmn:StartEvent',
'bpmn:IntermediateCatchEvent',
'bpmn:IntermediateThrowEvent',
'bpmn:BoundaryEvent',
'bpmn:EndEvent'
]
},
message: 'should be equal to one of the allowed values'
},
{
keyword: 'if',
dataPath: '',
schemaPath: '#/allOf/1/allOf/1/if',
params: {
'failingKeyword': 'then'
},
message: 'should match "then" schema'
},
{
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
Expand Up @@ -23,7 +23,7 @@ export const errors = [
{
keyword: 'required',
dataPath: '/elementType',
schemaPath: '#/allOf/1/allOf/0/then/properties/elementType/allOf/0/then/required',
schemaPath: '#/allOf/1/allOf/1/then/properties/elementType/allOf/0/then/required',
params: {
missingProperty: 'eventDefinition'
},
Expand All @@ -36,12 +36,12 @@ export const errors = [
'params': {
'failingKeyword': 'then'
},
'schemaPath': '#/allOf/1/allOf/0/then/properties/elementType/allOf/0/if'
'schemaPath': '#/allOf/1/allOf/1/then/properties/elementType/allOf/0/if'
},
{
keyword: 'if',
dataPath: '',
schemaPath: '#/allOf/1/allOf/0/if',
schemaPath: '#/allOf/1/allOf/1/if',
params: {
'failingKeyword': 'then'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ describe('validation', function() {


testTemplate('message-subscription-property-invalid-event-definition');


testTemplate('message-subscription-property-invalid-element-type');
});


Expand Down

0 comments on commit d134b5c

Please sign in to comment.