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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPM plugin to generate RemoteDataSource #31

Open
adriantabirta opened this issue Dec 3, 2022 · 1 comment
Open

SPM plugin to generate RemoteDataSource #31

adriantabirta opened this issue Dec 3, 2022 · 1 comment

Comments

@adriantabirta
Copy link

Hi,

nice repo, I have an idea - not sure if its gonna work, to add SPM plugin to generate whole RemoteDataSoucre from service using CombineGrpc. Would be a great tool to generate entirely whole server side code 馃樃

Like:

payService.proto

service PayService {
    rpc pay(Request) returns (Response) {}
}

PayRemoteDataSource.swift

public protocol PayRemoteDataSource {
    //... service methods with GRPC generated structs
   func pay(Request) -> AnyPublisher<Response, RPCError>
}

PayRemoteDataSourceImpl.swift

struct PayRemoteDataSourceImpl: PayRemoteDataSource  {
    //... real implementation using grpcExecutor 
}

I know that is possible but I have no idea how to build this kind of plugin

@vyshane
Copy link
Owner

vyshane commented Dec 5, 2022

CombineGRPC is implemented as a wrapper over Swift gRPC, and does not do any code generation. Swift gRPC does provide a protoc plugin for code generation though. Please see this directory for examples of how you could implement the server side with the Swift gRPC generated code + CombineGRPC.

Having said that, I'm not sure I understand your example. You mentioned server side code generation, but it looks like PayRemoteDataSource is used for making gRPC calls to the server? I.e. client code?

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