I have to validate more than 13.000 BPMN files that are to be migrated from Activiti to Camunda BPM. I already ran an XML schema validation and pushed them through the Camunda engine parser. However, the Camunda Modeler provides interesting warnings, that I would like to fix as well.
Is there a way to just run the validation of bpmn.js on all the files and get the results. An ideal solution would be a command line program that is started with a BPMN file name or its contents and then returns the log of errors and warnings. Some code in a unit test might work, too.
Depending on the warnings you are interested in, parsing the diagram with bpmn-moddle may be enough. It performs the meta-model/type checks XSD validation cannot perform by design. It runs in NodeJS and provides errors as well as warnings.
var BpmnModdle = require('bpmn-moddle');
var moddle = new BpmnModdle();
var xmlStr =
'<?xml version="1.0" encoding="UTF-8"?>' +
'<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" id="empty-definitions" targetNamespace="http://bpmn.io/schema/bpmn">' +
'</bpmn2:definitions>';
moddle.fromXML(xmlStr, function(err, definitions, parseContext) {
if (err) {
// we got an error
}
if (parseContext.warnings.length) {
// we got warnings...
}
});
Even more validation is performed upon importing the diagram with bpmn-js. This unfortunately requires a browser environment and is not as easy to script.