bpmn-visualization-js
bpmn-visualization-js copied to clipboard
[FEAT] Validate the BPMN input source
Is your feature request related to a problem? Please describe. An invalid (aka invalid regarding xml syntax and XSD) bpmn input source (file, string, stream, ....) should be rejected
Describe the solution you'd like The bpmn source a valid xml source and should conform to the set of XSD it references. So conformance check must first be done prior interpretation to ensure the defined model is valid. This will prevent subsequent parsing errors or incomplete renderings.
Don't forget the error cases, when a field is not mandatory, and is empty, when we parse it !!!
Validation may be made optional and performance tests should be conducted to measure the overhead introduced by the validation.
Describe alternatives you've considered N/A
Additional context
https://www.omg.org/spec/BPMN/2.0/About-BPMN
We could generate xml parsing error with the following guidance message: The file is not a BPMN file. see <BPMN spec link>
⚠️ Check the contribution guidelines for BPMN support
We are open to any libraries or proposal abvout how to implement this.
fast-xml-parser
is the library we are using to parse the BPMN XML source. It provides XML validation out of the box.
For schema validation, we would need to embed the schema sources in the library. So it would increase the lib size.
I suggest we only support XML validation and make it optional at BPMN load. For performance, it should be disabled as we behave today (in v0.23.3).
We are a visualization lib and we display process data on BPMN source that are supposed to be correctly modeled. We have tests that demonstrate that even with malformed XML, the lib does its best to display the data it was able to parse. This should be enough in most cases.