Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filling protobuf.any value in grpcui #206

Open
sahas-n opened this issue Nov 25, 2022 · 5 comments
Open

Filling protobuf.any value in grpcui #206

sahas-n opened this issue Nov 25, 2022 · 5 comments

Comments

@sahas-n
Copy link

sahas-n commented Nov 25, 2022

Most of our grpc APIs use google.protobuf.Any. However, I couldn't find a clear way to fill the "any" fields via grpcui. A default String type is populated for the any field. Is this field supported by grpcui? How can I pass the value to these any fields via grpcui?

image

@jhump
Copy link
Contributor

jhump commented Nov 27, 2022

You enter the type name in the top text box.

If it is a recognized type (part of the known schema for the selected method), it will populate the entry as a form for the message type. In the screenshots, since the selected type is StringValue, it just provides a simple text entry for the contained string value. But if you enter a more complicated type, it will turn into a form.

If you enter a message name that is not recognized, then instead of a form for that message type, you get a text area and must enter the value as a JSON object.

@AFMiziara
Copy link

@jhump I have generated a descriptor set with more message types (that are not direct dependencies from the gRPC Service) and expected them to appear as an entry option, but it does not appear. Isn't that supported?

@jhump
Copy link
Contributor

jhump commented Jun 29, 2023

@AFMiziara, not today I'm afraid. It would be possible to add though. The client would need to send a request to the server to get the schema for a single message type, which it would do when an unrecognized type name is entered. It could then use the type (if the server knows it) to populate the form, just as it already can today for known types.

But currently "known" types include only the ones in the transitive closure of the method that it downloads from the server and the "well-known" types (various messages in google.protobuf package).

@fabricio-suarte
Copy link

@jhump I solved it in way a little bit different. I let the user to specify a file containing these Server "known" types (message types) that are not direct dependencies of any service. So I can get their descriptors and deliver to the UI all the schemas properly. It worked for me.

@ebowden
Copy link

ebowden commented Oct 30, 2023

Hopping in to say this would be valuable to me, too. I have an interface that uses an Any type layer for abstraction like MIziara describes.

One oddness to me is if I use grpcurl to issue the raw command that grpcui displays, verbatim, it seems grpcurl (v1.8.9) can parse the abstracted Any response object into sensible fields, while grpcui (v1.3.3) leaves the Any field in an unencoded state. Would you expect different behavior for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants