Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC codegen support inherit methods #140

Open
martin-ncs opened this issue Jul 17, 2024 · 1 comment
Open

RPC codegen support inherit methods #140

martin-ncs opened this issue Jul 17, 2024 · 1 comment

Comments

@martin-ncs
Copy link

martin-ncs commented Jul 17, 2024

The current codegen only supports methods defined inline, so we can't extend the RPC definition interface, which is useful for re-using method definitions.

Here's a quick example:

interface SharedCalls {
    suspend fun inherit()
}

interface DefinitionRpc : RPC, SharedCalls {
    suspend fun inline()
}

suspend fun executeRpc() {
    val http = HttpClient {
        installRPC()
    }
    val rpc = http.rpc().withService<DefinitionRpc>()

    // client code expects these to work
    rpc.inline()
    rpc.inherit()
}

As the codegen wont generate the inheritmethod so the class DefinitionRpcClient wont compile, leading into this error:

Class 'DefinitionRpcClient' is not abstract and does not implement abstract member public abstract suspend fun inherit()
@Mr3zee
Copy link
Collaborator

Mr3zee commented Jul 17, 2024

Hi! Thank you for the ticket! We will consider implementing it after K2 support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants