Validate bpmn file before deployment creation

i want to validate bpmn file if it’s a valid modeler or not before create deployment
i’m using embeded camunda with spring boot app and create the deployment using
RepositoryService and deploymentBuilder

regards

What kind of things are you looking to validate?
In a lot of cases you can use the Camunda modeler Linting plugin, you could just define your own rules.

You can use fluent builder Bpmn.validateModel() to validate the bpmn model.

// create an empty model
BpmnModelInstance modelInstance = Bpmn.createEmptyModel();
Definitions definitions = modelInstance.newInstance(Definitions.class);
definitions.setTargetNamespace("http://camunda.org/examples");
modelInstance.setDefinitions(definitions);
// validate and write model to file
Bpmn.validateModel(modelInstance);

File file = File.createTempFile("bpmn-model-api-", ".bpmn");
Bpmn.writeModelToFile(file, modelInstance);