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

feat: peek/modify decoded unknown fields #46

Open
ii64 opened this issue Jul 25, 2022 · 2 comments
Open

feat: peek/modify decoded unknown fields #46

ii64 opened this issue Jul 25, 2022 · 2 comments
Labels
feature request Request for new feature

Comments

@ii64
Copy link
Member

ii64 commented Jul 25, 2022

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

We've got CarryingUnknownFields to see if there's unknown fields, but what we could do with it besides reflecting them back to wire data? Currently, _unknownFields is not exported, and no methods expose it. So technically, there's no way to touch them without going to unsafe.

Describe the solution you'd like, and alternatives you've considered

Expose _unknownFields field, or provide a method to expose it.
In addition, since field ids can be unordered, implement new method on type unknown.Fields to find the field id and field type, or matcher that calls back whether there's matched field id and field type.

Additional context

No additional context.

@lsjbd
Copy link
Contributor

lsjbd commented Aug 12, 2022

But what you want to do with those unknown fields? They are basically not supposed to be exposed to users.

@lsjbd lsjbd added the feature request Request for new feature label Aug 12, 2022
@ii64
Copy link
Member Author

ii64 commented Aug 14, 2022

Thank you for replying. I was thinking about google.protobuf.Any implementation for Thrift. These unknown structure/data will be encoded to unknown fields along with the type metadata.
EDIT: So in order to do that we need to access unexported _unknownFields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for new feature
Development

No branches or pull requests

2 participants