bpmnlint
Version:
Validate your BPMN diagrams based on configurable lint rules
44 lines (32 loc) • 896 B
JavaScript
const {
is
} = require('bpmnlint-utils');
const {
annotateRule
} = require('./helper');
/**
* A rule that checks that start events inside an event sub-process
* are typed.
*
* @type { import('../lib/types.js').RuleFactory }
*/
module.exports = function() {
function check(node, reporter) {
if (!is(node, 'bpmn:SubProcess') || !node.triggeredByEvent) {
return;
}
const flowElements = node.flowElements || [];
flowElements.forEach(function(flowElement) {
if (!is(flowElement, 'bpmn:StartEvent')) {
return false;
}
const eventDefinitions = flowElement.eventDefinitions || [];
if (eventDefinitions.length === 0) {
reporter.report(flowElement.id, 'Start event is missing event definition', [ 'eventDefinitions' ]);
}
});
}
return annotateRule('event-sub-process-typed-start-event', {
check
});
};