private static void validateDocument(SDDocumentType root, SDDocumentType currentDocument) {
        if (root.equals(currentDocument)) {
            throw new DocumentGraphException(currentDocument);
        }
        validateChildren(root, currentDocument);
    }
Validates that there are no cycles between document types (exception: self-reference is allowed).
Example: if document B inherits A, then A cannot have a document reference to B.

@author bjorncs
config-model/src/main/java/com/yahoo/schema/DocumentGraphValidator.java