Use FieldMaskUtil to _clear_ the fields specified in FieldMask
What language does this apply to? It's relevant for any language and proto version. Specifically I had this requirement in Java and proto2.
Describe the problem you are trying to solve. My specific usecase was as follows:
There's a ubiquitous proto object my server wants to share with several other servers. But this object contains several very-big (binary/text) fields which are irrelevant for most consumers. Before sending the proto to other servers, I want to clean it up. Ideally I'd like to to this without "hard coding" the fields names (i.e. use some configuration to remove undesired fields). So I can easily add/remove fields to clean up later.
I tried using FieldMaskUtils for this, but it currently only supports "keeping" the masked fields.
Describe the solution you'd like
Add to FieldMaskUtil a method which removes the fields specified in the FieldMask. i.e. the opposite of FieldMaskUtil.merge(), which keeps only the masked fields.
Describe alternatives you've considered
- "hard code" the fields I want to remove (this is what I chose for now)
- Write a custom recursive+reflective implementation of my suggestion, outside of FieldMaskUtil and without utilizing
FieldMaskTree
Additional context I'd love to contribute code for this, if the feature-request is accepted
Jerry, this sounds like a fairly reasonable request. Do you want to work with selotape around turning it into a proposal so he can land it?
Hey, by "proposal" do you mean a PR?
Or is there another approval phase we need to go through before starting to code this?
Would you mind if I start working on a PR and we'll continue the discussion on it?
Yes. I can help with this.
On Fri, Jul 1, 2022 at 4:49 PM Matt Fowles Kulukundis < @.***> wrote:
Jerry, this sounds like a fairly reasonable request. Do you want to work with selotape around turning it into a proposal so he can land it?
— Reply to this email directly, view it on GitHub https://github.com/protocolbuffers/protobuf/issues/10198#issuecomment-1172769051, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZRRDX3BN3T5I5OAHHFLP3LVR5YYBANCNFSM52OAK7WQ . You are receiving this because you were assigned.Message ID: @.***>
-- Jerry Berg | Software Engineer | @.*** | 720-808-1188
Hi Ron,
I'm fine if you want to start on the PR. I'm new to the process as well, but I think because this is a new API dealing with fieldmasks we might need a doc. I'll clarify what's actually needed.
-Jerry
On Wed, Jul 6, 2022 at 6:00 AM Jerry Berg @.***> wrote:
Yes. I can help with this.
On Fri, Jul 1, 2022 at 4:49 PM Matt Fowles Kulukundis < @.***> wrote:
Jerry, this sounds like a fairly reasonable request. Do you want to work with selotape around turning it into a proposal so he can land it?
— Reply to this email directly, view it on GitHub https://github.com/protocolbuffers/protobuf/issues/10198#issuecomment-1172769051, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZRRDX3BN3T5I5OAHHFLP3LVR5YYBANCNFSM52OAK7WQ . You are receiving this because you were assigned.Message ID: @.***>
-- Jerry Berg | Software Engineer | @.*** | 720-808-1188
-- Jerry Berg | Software Engineer | @.*** | 720-808-1188
Thanks,
But please start by reading shaod2s resolution to my PR. I don't want to waste your time on this if this is not feasible.
@selotape: Can I check whether this issue is still important to you? I'm trying to get a handle on "everything FieldMask-related" that needs attention, so I'm looking through issues about it. If you definitely want something like this still, I can try to include it in whatever plans I come up with - but I'm also looking to limit the scope as far as I reasonably can, so if you've come up with workarounds that you're reasonably happy with, I'd prefer to just close this. Please let me know.
This was always a nice-to-have. I've worked around this a long time ago. Feel free to close.
Thank you Jon!
On Thu, 6 Jul 2023, 17:02 Jon Skeet, @.***> wrote:
@selotape https://github.com/selotape: Can I check whether this issue is still important to you? I'm trying to get a handle on "everything FieldMask-related" that needs attention, so I'm looking through issues about it. If you definitely want something like this still, I can try to include it in whatever plans I come up with - but I'm also looking to limit the scope as far as I reasonably can, so if you've come up with workarounds that you're reasonably happy with, I'd prefer to just close this. Please let me know.
— Reply to this email directly, view it on GitHub https://github.com/protocolbuffers/protobuf/issues/10198#issuecomment-1623736808, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMXR3TOGN7Q25QFZEBCVYTXO3AO3ANCNFSM52OAK7WQ . You are receiving this because you were mentioned.Message ID: @.***>
@selotape: Thanks for your understanding :) (I'll try to bear this in mind while working on other FieldMask aspects. If it happens to drop out of other work, that would be great...)