public ArrayList<Diagnostic> identify(SchemaNode node) {
        // TODO: semantic context
        ArrayList<Diagnostic> ret = new ArrayList<>();

        DeprecatedToken entry = deprecatedTokens.get(node.getSchemaType());
        if (entry != null) {
            ret.add(
                new SchemaDiagnostic.Builder()
                    .setRange(node.getRange())
                    .setMessage(node.getText() + " is deprecated. " + entry.message)
                    .setSeverity(DiagnosticSeverity.Warning)
                    .setCode(entry.code)
                    .build()
            );

            return ret;
        }

        if ((node.getSchemaType() == TokenType.ATTRIBUTE || node.getSchemaType() == TokenType.INDEX) && node.getNextSibling() != null && node.getNextSibling().isASTInstance(identifierStr.class)) {
            String offendingKind;
            DiagnosticCode code;

            if (node.getSchemaType() == TokenType.ATTRIBUTE) {
                offendingKind = "attribute";
                code = DiagnosticCode.DEPRECATED_TOKEN_ATTRIBUTE;
            } else {
                offendingKind = "index";
                code = DiagnosticCode.DEPRECATED_TOKEN_INDEX;
            }

            String attributeName = node.getNextSibling().getText();
            Node fieldNode = node;

            while (fieldNode != null && !fieldNode.isASTInstance(structFieldElm.class) && !fieldNode.isASTInstance(fieldElm.class)) {
                fieldNode = fieldNode.getParent();
            }

            if (fieldNode != null && !fieldNode.get(1).getText().equals(attributeName)) {
                String fieldIdentifier = fieldNode.get(1).getText();

                if (fieldNode.getParent().isASTInstance(fieldOutsideDoc.class)) {
                    ret.add(
                        new SchemaDiagnostic.Builder()
                            .setRange(node.getNextSibling().getRange())
                            .setMessage("Cannot create " + offendingKind + " '" + attributeName + "' in field '" + fieldIdentifier + "' outside document.")
                            .setSeverity(DiagnosticSeverity.Error)
                            .build()
                    );
                } else {
                    ret.add(
                        new SchemaDiagnostic.Builder()
                            .setRange(node.getNextSibling().getRange())
                            .setMessage("Creating an " + offendingKind + " for field '" + fieldIdentifier + "' with a different name '" + attributeName + 
                                "' than the field name is deprecated, and support will be removed in Vespa 9. "
                              + " Create a field with the wanted name outside the document instead.")
                            .setSeverity(DiagnosticSeverity.Warning)
                            .setCode(code)
                            .build()
                    );
                }
            }
        }

        return ret;
    }
Identifies deprecated tokens or simple deprecated patterns and sends a warning to the client
integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/parser/schema/IdentifyDeprecatedToken.java