Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grpc code first JSON transcoding in .Net 7

Tags:

json

c#

grpc

I am trying to add grpc json transcoding to my grpc code first project but can't seem to figure out on how to add that "option"

In the Microsoft demo the set the json transcoding as follows in the protobuf file

  rpc SayHello (HelloRequest) returns (HelloReply) {
    option (google.api.http) = {
      get: "/v1/greeter/{name}"
    };
  }
}

In code first you have the following as an example as your protobuf but I can't seem to figure out how to add that option for the json transcoding

 [ServiceContract]
    public interface IReportService
    {
        [OperationContract]
        Task<ReportListResponse> Getreports(ProtoBuf.Grpc.CallContext context = default);
    }
like image 449
Dominic Joubert Avatar asked Sep 21 '26 20:09

Dominic Joubert


1 Answers

Currently, no: not supported. It is something we can consider as a future investment, but: everything is time :/

There is nothing stopping you from defining your services in proto files and then transcoding them but yeah that's a giant pain the arse if you have request or response schemas that are not very lightweight.

like image 91
Buvy Avatar answered Sep 24 '26 09:09

Buvy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!