diff --git a/rules/camunda-cloud/escalation-reference.js b/rules/camunda-cloud/escalation-reference.js index b9e2475e..b3e9e7ab 100644 --- a/rules/camunda-cloud/escalation-reference.js +++ b/rules/camunda-cloud/escalation-reference.js @@ -24,27 +24,35 @@ module.exports = skipInNonExecutableProcess(function() { return; } - let errors = hasProperties(eventDefinition, { - escalationRef: { - required: true - } - }, node); + let errors = []; - if (errors && errors.length) { - reportErrors(node, reporter, errors); + if (!isNoEscalationRefAllowed(node)) { + errors = hasProperties(eventDefinition, { + escalationRef: { + required: true + } + }, node); - return; + if (errors.length) { + reportErrors(node, reporter, errors); + + return; + } } const escalationRef = eventDefinition.get('escalationRef'); + if (!escalationRef) { + return; + } + errors = hasProperties(escalationRef, { escalationCode: { required: true } }, node); - if (errors && errors.length) { + if (errors.length) { reportErrors(node, reporter, errors); } } @@ -53,3 +61,7 @@ module.exports = skipInNonExecutableProcess(function() { check }; }); + +function isNoEscalationRefAllowed(node, version) { + return is(node, 'bpmn:BoundaryEvent'); +} \ No newline at end of file diff --git a/test/camunda-cloud/escalation-reference.spec.js b/test/camunda-cloud/escalation-reference.spec.js index ce5d0ead..aaf8a972 100644 --- a/test/camunda-cloud/escalation-reference.spec.js +++ b/test/camunda-cloud/escalation-reference.spec.js @@ -22,6 +22,27 @@ const valid = [ `)) }, + { + name: 'escalation boundary event', + moddleElement: createModdle(createDefinitions(` + + + + + + + + `)) + }, + { + name: 'escalation boundary event (no escalation reference)', + moddleElement: createModdle(createProcess(` + + + + + `)) + }, { name: 'end event (message)', moddleElement: createModdle(createProcess(`