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

protocmp: support custom Resolvers in Transform #1377

Closed
tommie opened this issue Oct 22, 2021 · 1 comment
Closed

protocmp: support custom Resolvers in Transform #1377

tommie opened this issue Oct 22, 2021 · 1 comment

Comments

@tommie
Copy link

tommie commented Oct 22, 2021

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

When using Any in unit tests for a proxy, I want to be able dynamically generate Protobuf definitions, load them using dynamicpb and compare them with protocmp. In this case, I read the FileDescriptorSet from storage rather than having them compiled in.

Describe the solution you'd like
There's already a TODO in handling Any suggesting support for a custom resolver. I think this is a good idea.

My proposal is to simply add a MessageTypeResolver(protoregistry.MessageTypeResolver) option to Transform. It requires creating a transformer struct, and making many of the (unexported) functions members of it. See tommie/protobuf-go@0a7aeae for a PoC.

Describe alternatives you've considered
Just having a "testing.proto" where I put all the various protos I need for testing. In my case, the FileDescriptorSet is generated together with other information, and requiring one path for production and one for testing is inconvenient.

@neild neild changed the title Support a custom Resolver in protocmp.Transform protocmp: support custom Resolvers in Transform Nov 4, 2021
@neild
Copy link
Contributor

neild commented Nov 4, 2021

This seems reasonable to me.

cc @joetsai

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

2 participants