riok / Kreya

Kreya is a GUI client for gRPC and REST APIs with innovative features for environments, authorizations and more.
https://kreya.app
279 stars 5 forks source link

Importing .proto definition in script #222

Open DominicMCN opened 2 months ago

DominicMCN commented 2 months ago

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.

CommonGuy commented 2 months ago

I get the use case and added this to our backlog