private List<Diagnostic> verifyFileName() {
        List<Diagnostic> ret = new ArrayList<>();

        List<Symbol> schemaSymbols = schemaIndex.getSymbolsByType(SymbolType.SCHEMA);

        Symbol schemaIdentifier = null;

        for (Symbol symbol : schemaSymbols) {
            if (symbol.getFileURI().equals(fileURI)) {
                schemaIdentifier = symbol;
                break;
            }
        }

        if (schemaIdentifier != null) {
            schemaDocumentIdentifier = schemaIdentifier.getShortIdentifier();

            if (!getFileName().equals(schemaDocumentIdentifier + ".sd")) {
                ret.add(new SchemaDiagnostic.Builder()
                    .setRange(schemaIdentifier.getNode().getRange())
                    .setMessage("Schema " + schemaDocumentIdentifier + " should be defined in a file with the name: " + schemaDocumentIdentifier + ".sd. File name is: " + getFileName())
                    .setCode(DiagnosticCode.SCHEMA_NAME_SAME_AS_FILE)
                    .setSeverity(DiagnosticSeverity.Error)
                    .build()
                );
            }
        }

        return ret;
    }
SchemaDocument parses and represents .sd files
integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/SchemaDocument.java