use of io.apicurio.datamodels.core.validation.DefaultSeverityRegistry in project apicurio-data-models by Apicurio.
the class Library method validate.
/**
* @deprecated
* This method has been deprecated. It will continue to be supported but will be removed in a future release.
* <p> Use {@link Library#validateDocument(Node, IValidationSeverityRegistry, List)} instead.
*
* Called to validate a data model node. All validation rules will be evaluated and reported. The list
* of validation problems found during validation is returned. In addition, validation problems will be
* reported on the individual nodes themselves. Validation problem severity is determined by checking
* with the included severity registry. If the severity registry is null, a default registry is used.
* @param node
* @param severityRegistry
*/
public static List<ValidationProblem> validate(Node node, IValidationSeverityRegistry severityRegistry) {
if (severityRegistry == null) {
severityRegistry = new DefaultSeverityRegistry();
}
// Clear/reset any problems that may have been found before.
ValidationProblemsResetVisitor resetter = VisitorFactory.createValidationProblemsResetVisitor(node.ownerDocument());
visitTree(node, resetter, TraverserDirection.down);
// Validate the data model.
ValidationVisitor validator = VisitorFactory.createValidationVisitor(node.ownerDocument());
validator.setSeverityRegistry(severityRegistry);
visitTree(node, validator, TraverserDirection.down);
return validator.getValidationProblems();
}
Aggregations