scalapb / zio-grpc

ScalaPB meets ZIO: write purely functional gRPC services and clients using ZIO
Apache License 2.0
257 stars 81 forks source link

provide request in context transforms #581

Open rtkaczyk opened 7 months ago

rtkaczyk commented 7 months ago

Goal

Add request parameter to GTransform

Rationale

To be able to decorate a service with an access log, as advertised in the docs. See LoggingTransform for an example.

rtkaczyk commented 7 months ago

@thesamet could you kindly consider this PR?

thesamet commented 7 months ago

Hi @rtkaczyk , thanks for working on this, I appreciate the time you invested in putting the PR together. Since this is a breaking change that also adds complexity for the type signatures for all users of transformations, I prefer that we explore a different approach. The use case can be accomplished with ServerInterceptor that would override the listener. See this answer here: https://stackoverflow.com/a/68102211/97524 . I wonder if we can provide an idiomatic and this wrapper for this functionality in zio-grpc. Would you be open to look into that too?

rtkaczyk commented 7 months ago

Thanks for the suggestion, I'll have a look