bpmnlint
Version:
Validate your BPMN diagrams based on configurable lint rules
34 lines (25 loc) • 632 B
JavaScript
const {
is
} = require('bpmnlint-utils');
const {
annotateRule
} = require('./helper');
/**
* A rule that verifies that an event contains maximum one event definition.
*
* @type { import('../lib/types.js').RuleFactory }
*/
module.exports = function() {
function check(node, reporter) {
if (!is(node, 'bpmn:Event')) {
return;
}
const eventDefinitions = node.eventDefinitions || [];
if (eventDefinitions.length > 1) {
reporter.report(node.id, 'Event has multiple event definitions', [ 'eventDefinitions' ]);
}
}
return annotateRule('single-event-definition', {
check
});
};