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

Marshallers Required Implicitly #278

Closed
juanpedromoreno opened this issue May 28, 2018 · 2 comments
Closed

Marshallers Required Implicitly #278

juanpedromoreno opened this issue May 28, 2018 · 2 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@juanpedromoreno
Copy link
Member

The current @service macro is requiring the Marshallers with the implicitly identifier, this is preventing to provide other marshallers externally of the macro, since the generated companion object is not able to find them.

https://github.com/frees-io/freestyle-rpc/blob/9f898c9/modules/internal/src/main/scala/service.scala#L205-L206

A potential solution would be changing the current macro, where instead of a val, we implement them as a def, requiring them as part of the method definition. Example:

q"""
       $wartSuppress
       def ${Pat.Var.Term(descriptorName)}(implicit RQM: _root_.io.grpc.MethodDescriptor.Marshaller[$requestType], RSM: _root_.io.grpc.MethodDescriptor.Marshaller[$responseType]): _root_.io.grpc.MethodDescriptor[$requestType, $responseType] = {
         $encodersImport
         _root_.io.grpc.MethodDescriptor
           .newBuilder(RQM, RSM)
           .setType(${utils.methodType(streamingType)})
           .setFullMethodName(
             _root_.io.grpc.MethodDescriptor.generateFullMethodName(${Lit.String(algName.value)}, ${Lit
      .String(name.value)}))
           .build()
       }
      """
@juanpedromoreno juanpedromoreno added bug Something isn't working enhancement New feature or request labels May 28, 2018
@fedefernandez
Copy link
Contributor

I've this WIP #279 with all the macros and server module migrated (including tests). The problem is I'm getting this weird error:

[error] Caused by: sbt.ForkMain$ForkError: java.lang.NullPointerException: requestMarshaller
[error] 	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:787)
[error] 	at io.grpc.MethodDescriptor.<init>(MethodDescriptor.java:230)
[error] 	at io.grpc.MethodDescriptor.<init>(MethodDescriptor.java:40)
[error] 	at io.grpc.MethodDescriptor$Builder.build(MethodDescriptor.java:567)
[error] 	at freestyle.rpc.protocol.Utils$service$RPCAvroService$.unaryMethodDescriptor(Utils.scala:19)
[error] 	at freestyle.rpc.protocol.Utils$service$RPCAvroService$.bindService(Utils.scala:54)
[error] 	at freestyle.rpc.protocol.Utils$FreesRuntime.$init$(Utils.scala:550)
[error] 	at freestyle.rpc.protocol.Utils$implicits$.<init>(Utils.scala:572)
[error] 	at freestyle.rpc.protocol.Utils$implicits$.<clinit>(Utils.scala)
[error] 	at freestyle.rpc.protocol.RPCTests.$anonfun$new$4(RPCTests.scala:73)

@pepegar
Copy link
Member

pepegar commented Jul 3, 2018

fixed in #330

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants