Add metadata for gRPC reflection API#50
Add metadata for gRPC reflection API#50Nymphium wants to merge 10 commits intoandersfugmann:mainfrom
Conversation
andersfugmann
left a comment
There was a problem hiding this comment.
Thanks. LGTM. I've have one question on naming though.
Also before we merge, could you give a simple example of all the metadata created around service endpoints for gRPC? I'd like to understand if more fields could be moved into this structure to clean up and hopefully it would also be easier to add additional fields going forward.
src/ocaml_protoc_plugin/spec.ml
Outdated
| | Bytes -> Bytes.create 0 | ||
| | Enum (module Enum) -> Enum.from_int_exn 0 | ||
|
|
||
| module type Metainfo = sig |
There was a problem hiding this comment.
Does metainfo have a special definition in the gRPC standard? If not, then I think it would be better to call it something like Service_info
There was a problem hiding this comment.
No it may not be a standard. I agree with Service_info 👍
|
@andersfugmann https://github.com/Nymphium/oresai/blob/main/server/protos/generated/grpc_reflection_v1_reflection.ml#L2025 |
|
Thanks for providing examples. Would it be possible to make the list of endpoints be a list of modules instead to avoid string duplication? let package_service_names =
[ (module Grpc.Reflection.V1.ServerReflection : Rpc); ... ]Should hold the same (if not more) information and avoid string duplication. Btw. Since this information is only needed for gRPC, maybe call the module |
|
@andersfugmann I've applied the changes in 4fb8d6e.
I addeed
It's difficult to achieve that in some cases. |
andersfugmann
left a comment
There was a problem hiding this comment.
Looks very good. Thanks for making the updates.
I'm not sure I follow. The service names are already collected as part of emitting the signature and implementation of all messages and services defined in the proto file. I may take a stab at implementing that, but I would prefer to the two other comments + tests addressed first. Again, Thanks for doing this work. Really appreciated! |
|
@andersfugmann I've updated the code based on your suggestions and added tests 🎍 |
This PR adds
Metainfomodule to each generated files.That module has information to implement gRPC reflection API: