riok/Kreya

Importing .proto definition in script

DominicMCN opened this issue · 1 comments

Is your feature request related to a problem? Please describe.

Many times, I want to check which oneOf is being set in script. In json format, it would be quite inconvenient as I have to do something like

Object.keys(payload).includes("...") || ...

It would be useful if we can import the protobuf definition being used for current request in script, so we could use something like https://github.com/protobufjs/protobuf.js?tab=readme-ov-file#using-json-descriptors for reflection.

Describe the solution you'd like

Being able to access the .proto being used for request in script. For example via something like kreyaGrpc.definition. Furthurmore, it would be great to also have access to the request before it's sent (not sure if it's already available) via something like kreyaGrpc.request.

Describe alternatives you've considered

As described above, i currently have to do includes for all of the oneOf types, which can get big pretty fast.

I get the use case and added this to our backlog