bpmn-io / bpmnlint

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

Element is not connected error without <incoming> and <outgoing> #28

Closed StephenOTT closed 5 years ago

StephenOTT commented 5 years ago

We are seeing with some older models that the linter expects specific XML format. The new linter seems to expect a outgoing property within the Bpmn element.

Is this change requirement documented somewhere?

nikku commented 5 years ago

Could you share an old diagram for which that behavior occurs? That would help us tremendously.

Is this change requirement documented somewhere?

There was no explicit change I am aware of and there exist no explicit requirements.

StephenOTT commented 5 years ago

@nikku

Bad XML

<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="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="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
  <bpmn2:process id="Process_1" name="StartEvent">
    <bpmn2:startEvent id="StartEvent_1" name="StartEvent" />
    <bpmn2:task id="Task_0z482ch" name="Task1" />
    <bpmn2:sequenceFlow id="SequenceFlow_1uaj557" sourceRef="StartEvent_1" targetRef="Task_0z482ch" />
    <bpmn2:sequenceFlow id="SequenceFlow_100xie7" sourceRef="Task_0z482ch" targetRef="EndEvent_07md7d9" />
    <bpmn2:endEvent id="EndEvent_07md7d9" name="EndEvent">
      <bpmn2:incoming>SequenceFlow_100xie7</bpmn2:incoming>
    </bpmn2:endEvent>
  </bpmn2:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="412" y="240" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Task_0z482ch_di" bpmnElement="Task_0z482ch">
        <dc:Bounds x="525" y="218" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_1uaj557_di" bpmnElement="SequenceFlow_1uaj557">
        <di:waypoint x="448" y="258" />
        <di:waypoint x="525" y="258" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_100xie7_di" bpmnElement="SequenceFlow_100xie7">
        <di:waypoint x="625" y="258" />
        <di:waypoint x="675" y="258" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="EndEvent_07md7d9_di" bpmnElement="EndEvent_07md7d9">
        <dc:Bounds x="675" y="240" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="669" y="283" width="49" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn2:definitions>

fixed xml creating from scratch:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="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="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
  <bpmn2:process id="Process_1" name="StartEvent">
    <bpmn2:startEvent id="StartEvent_1" name="StartEvent">
      <bpmn2:outgoing>SequenceFlow_0evmhj4</bpmn2:outgoing>
    </bpmn2:startEvent>
    <bpmn2:task id="Task_0z482ch" name="Task1">
      <bpmn2:incoming>SequenceFlow_0evmhj4</bpmn2:incoming>
      <bpmn2:outgoing>SequenceFlow_1a9p886</bpmn2:outgoing>
    </bpmn2:task>
    <bpmn2:endEvent id="EndEvent_07md7d9" name="EndEvent">
      <bpmn2:incoming>SequenceFlow_1a9p886</bpmn2:incoming>
    </bpmn2:endEvent>
    <bpmn2:sequenceFlow id="SequenceFlow_0evmhj4" sourceRef="StartEvent_1" targetRef="Task_0z482ch" />
    <bpmn2:sequenceFlow id="SequenceFlow_1a9p886" sourceRef="Task_0z482ch" targetRef="EndEvent_07md7d9" />
  </bpmn2:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="412" y="240" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="405" y="283" width="53" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Task_0z482ch_di" bpmnElement="Task_0z482ch">
        <dc:Bounds x="507" y="218" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="EndEvent_07md7d9_di" bpmnElement="EndEvent_07md7d9">
        <dc:Bounds x="675" y="240" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="669" y="283" width="49" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_0evmhj4_di" bpmnElement="SequenceFlow_0evmhj4">
        <di:waypoint x="448" y="258" />
        <di:waypoint x="507" y="258" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_1a9p886_di" bpmnElement="SequenceFlow_1a9p886">
        <di:waypoint x="607" y="258" />
        <di:waypoint x="675" y="258" />
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn2:definitions>

Can see the change with

    <bpmn2:startEvent id="StartEvent_1" name="StartEvent">
      <bpmn2:outgoing>SequenceFlow_0evmhj4</bpmn2:outgoing>
    </bpmn2:startEvent>
nikku commented 5 years ago

This is related to the no-disconnected rule that relies on the bindings to be complete.

You may disable the no-disconnected rule, if it causes you false positives. As an alternative, you may also file a PR that improves the working of this rule.

I'm closing this issue, as we have no intention to improve support for those diagrams in the near future (cf. https://github.com/bpmn-io/bpmnlint/issues/28#issuecomment-478165182).

StephenOTT commented 5 years ago

Why is this closed? It is a gap or bug in the way the Bpmn XML is generated and subsequently linted: prior to the linter, the modler was generating valid/functional and visually functional XML that has the proper connections. The activities were connected with a sequence flow. But the implementation of the linter requires a different XML structure as it was not expecting the previous structure. This seems like a bug or at least a gap.

Would also be nice to know when this XML change was made, so we can identify which bpmns need to be fixed. There does not appear to be any Bpmn versioning IDs in the XML that would indicate a change in the modler or spec conformance.

nikku commented 5 years ago

The case you describe is the fact that flow elements are missing <incoming> and <outgoing> refs to connected model elements. This is something that should generally not happen (it may happen though, if you use some DSL / API) to generate diagrams automatically).

I closed this with pr-welcome to indicate that we have no intention to act on this issue from our side. We have no intention to fix / act on this issue in the scope of bpmnlint. At the same time I indicated how you may work around this issue. I encourage you to improve the situation with your contribution to this repository.

Would also be nice to know when this XML change was made, so we can identify which bpmns need to be fixed.

This is a separate issue which, in no way, is related to bpmnlint. Indeed, it would be interesting to understand how you produced such model. bpmn-js will, to my knowledge, always produces the proper XML to reflect the relationship between elements in a bi-directional manner.

Please open an issue in bpmn-js if you find a situation where XML generated by the library does not satisfy the basic modeling conditions set up by bpmnlint.

StephenOTT commented 5 years ago

@nikku are you saying that if the outgoing is missing that the rendered Bpmn should not have the sequence flow connecting it? And if you are to run that Bpmn in the Camunda engine, the engine would throw a deployment error with a connected flow?/or you would not be able to reach that activitity?

nikku commented 5 years ago

A diagram without <incoming> and <outgoing> will execute just fine on the engine. The same applies to diagrams without DI (graphical information). Such minimal diagrams may, however, lead to false positives / negatives when being piped through this tool.

Help us to improve this situation with a PR.

dishui1238 commented 1 year ago

Did you eventually find a solution to this problem? I'm also encountering a similar issue. @StephenOTT