bpmn-io / bpmnlint

Validate BPMN diagrams based on configurable lint rules.
MIT License
121 stars 36 forks source link

Rule that identifies missing bpmndi for a bpmn elements with visual representation #55

Closed MaxTru closed 3 years ago

MaxTru commented 3 years ago

The rule should detect the following modeling patterns

We have a SupportCase, where a bpmndi is missing for boundary events, which therefore vanish -> leading to undersired effects on the engine. See https://jira.camunda.com/browse/SUPPORT-9121.

As a solution we could offer bpmnlint

Example:

<?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_0guwkgi" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.3.0">
  <bpmn:process id="Process_0so19rs" isExecutable="true">
    <bpmn:startEvent id="StartEvent_1">
      <bpmn:outgoing>Flow_0y554ej</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:task id="Activity_0chj4yv">
      <bpmn:incoming>Flow_0y554ej</bpmn:incoming>
    </bpmn:task>
    <bpmn:sequenceFlow id="Flow_0y554ej" sourceRef="StartEvent_1" targetRef="Activity_0chj4yv" />
    <bpmn:boundaryEvent id="Event_16w15x0" attachedToRef="Activity_0chj4yv">
      <bpmn:timerEventDefinition id="TimerEventDefinition_1ybo5te" />
    </bpmn:boundaryEvent>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_0so19rs">
      <bpmndi:BPMNEdge id="Flow_0y554ej_di" bpmnElement="Flow_0y554ej">
        <di:waypoint x="215" y="117" />
        <di:waypoint x="270" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="179" y="99" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0chj4yv_di" bpmnElement="Activity_0chj4yv">
        <dc:Bounds x="270" y="77" width="100" height="80" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

Note that the boundary event will not be visible, because the bpmndi information is missing.

How does the rule improve the BPMN diagram?

By having this rule, the mismatch between the visual representation and the execution semantics (which does not care about the di) becomes apparent.

Rule Details

What alternatives did you consider?

Error message on bpmn-js level when bpmdi is missing

MaxTru commented 3 years ago

as I learnt from @nikku ,

We should support both with this rule.

TODO: add example with multiple DIs