@Override
	public ArrayList<Diagnostic> identify(SchemaNode node) {
        ArrayList<Diagnostic> ret = new ArrayList<>();
        if (!node.isSchemaASTInstance(rootSchema.class))return ret;

        if (node.size() < 2 || node.get(1).getIsDirty()) {
            // Schema has bad syntax. Missing mandatory document would not be helpful
            return ret;
        }

        // Look for document definition inside
        for (Node child : node) {
            if (!child.getSchemaNode().isSchemaASTInstance(rootSchemaItem.class)) continue;
            if (child.size() == 0) continue;
            if (child.get(0).getSchemaNode().isSchemaASTInstance(documentElm.class)) return ret; // Found document
        }

        ret.add(new SchemaDiagnostic.Builder()
            .setRange(node.get(0).getRange())
            .setMessage("Missing mandatory document definition in schema body.")
            .setSeverity(DiagnosticSeverity.Error)
            .setCode(DiagnosticCode.DOCUMENTLESS_SCHEMA)
            .build());
        return ret;
	}
Identify a schema without a document, and sends an error if no document was found inside the schema
integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/parser/schema/IdentifyDocumentlessSchema.java