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

Support DiscardUnknownFieldsParser #4771

Open
kaelzhang opened this issue Aug 17, 2018 · 2 comments
Open

Support DiscardUnknownFieldsParser #4771

kaelzhang opened this issue Aug 17, 2018 · 2 comments

Comments

@kaelzhang
Copy link

Please answer these questions before submitting your issue.

What version of gRPC are you using?

1.14.0

What did you expect to see?

We could disable generating unknownFields from proto messages. It will be great if we could specify the setting by using gradle.

@zpencer zpencer added this to the Unscheduled milestone Aug 21, 2018
@carl-mastrangelo
Copy link
Contributor

Some thoughts on this:

  • Allowing the Marshaller to be modified to discard unknown fields is tricky. The marshaller lives in ProtoLiteUtils but is missing methods for discarding unknown fields. PLU uses ProtobufLite 3.0.~ which is missing the methods
  • Allowing a customer CodedInputStream per message might be feasible, perhaps calling into a user provided factory. The issue here is what should be provided to the factory? I was thinking:
interface Factory {
  CodedInputStream(InputStream message);
}

This allows customizing the parsing, but has two drawbacks:

  1. The ExtensionRegistry cannot be set this way. It has to be provided to the Parser.
  2. A user provided factory cannot take advantage of the buffer caching we do in our parser.

I don't see a clean way of exposing this and allowing code reuse.

@ejona86
Copy link
Member

ejona86 commented Feb 16, 2023

This is very similar to #9643

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

No branches or pull requests

4 participants