Skip to content

Commit

Permalink
fix(no-bpmndi): handle missing bpmnElement on BPMNEdge or `BPMNSh…
Browse files Browse the repository at this point in the history
…ape`
  • Loading branch information
marcoroth authored and nikku committed Jan 2, 2025
1 parent 7489dd0 commit f080a1c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rules/no-bpmndi.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function getAllDiBpmnReferences(definitionsNode) {

return diElements.map((element) => {

return element.bpmnElement.id;
return element.bpmnElement?.id;
});
})
);
Expand Down
3 changes: 3 additions & 0 deletions test/rules/no-bpmndi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ RuleTester.verify('no-bpmndi', rule, {
},
{
moddleElement: readModdle(__dirname + '/no-bpmndi/valid-message-flow.bpmn')
},
{
moddleElement: readModdle(__dirname + '/no-bpmndi/ignore-edge-without-bpmn-element.bpmn')
}
],
invalid: [
Expand Down
10 changes: 10 additions & 0 deletions test/rules/no-bpmndi/ignore-edge-without-bpmn-element.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1k364re" targetNamespace="http://bpmn.io/schema/bpmn">
<bpmn:process id="Process_1iz3i5x" isExecutable="true"></bpmn:process>

<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1">
<bpmndi:BPMNEdge id="Flow_0agwm11_di" bpmnElement="does-not-exist"></bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

0 comments on commit f080a1c

Please sign in to comment.