well-typed / grapesy

Native Haskell gRPC client and server based on `http2`
38 stars 4 forks source link

Support Protobuf `Any` type #146

Open edsko opened 5 months ago

edsko commented 5 months ago

See https://protobuf.dev/programming-guides/proto3/#any . Note that the status of Any is reported here as "Currently the runtime libraries for working with Any types are under development".

Supporting this is a bit awkward; following the spec exactly

import "google/protobuf/any.proto";

message ExampleMessage {
  google.protobuf.Any exampleField = 1;
}

currently results in Haskell code that imports

import qualified Proto.Google.Protobuf.Any

where that Proto. prefix depends on the location of the .proto definition using Any, as well as the precise way that protoc was invoked. Proper support for Any will probably require patching proto-lens-protoc (and possibly even requiring explicit support from protoc?).

edsko commented 4 months ago

An additional complication here is what to do with ProtoJson (not yet implemented; #166). See Protocol Buffers, Part 3 — JSON Format for discussion.