Currently validation is somewhat configurable: A custom validation module could be written and configured in fedora.fcfg.
This isn't that flexible as it means that if the existing validation was also to be carried out, then that would need to be called by the custom validator. A better design pattern might be something like the management Decorator pattern we already used.
We also might consider allowing validators to operate on the digital object, rather than a file or inputstream - it may be more convenient for the validator to access the object itself rather than FOXML.
We perhaps also might distinguish between different types of validation, eg validation of the FOXML vs validation of the object - the FOXML is a serialisation of the object, it is not the object itself.
Existing validation on doCommit() (DefaultDOManager) only happens in debug - but the validator is invoked on ingest separately.
The existing validation could be refactored so that the XML validation and schematron validation become decorator implementations.
We should also consider relationships validation (which is carried out by the ValidationUtility, and not included in the DOValidatorImpl).
Perhaps the REST validate endpoint could also be extended (and configurable) to validate using the above as well as the current ECM validation.