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

Implement PATCH behavior for user edits #57

Open
bushidocodes opened this issue Nov 13, 2019 · 0 comments
Open

Implement PATCH behavior for user edits #57

bushidocodes opened this issue Nov 13, 2019 · 0 comments
Labels

Comments

@bushidocodes
Copy link
Owner

bushidocodes commented Nov 13, 2019

When we edit users, we want to be able to do partial edits and not wipe out fields inadvertantly.

gRPC3 assumes PUT or full edits, as they serialize default values for any fields in a message that aren't explicitly set (edited). You can read about this here: https://developers.google.com/protocol-buffers/docs/proto3#default

This makes it harder for us to be explicit with what we want to set. We could filter out default values when updating data, but that's not great, as sometimes, we actually want to set a value to 0 in an edit.
The solution to this a gRPC FieldMask, which is a string that expresses which fields we want to set
https://developers.google.com/protocol-buffers/docs/reference/csharp/class/google/protobuf/well-known-types/field-mask

So to achieve this:

  1. The relevant protobuf messages need to add a fieldmask
  2. The client needs to set the fieldmask
  3. The correct node needs to read the fieldmask and only update the fields contained inside
@bushidocodes bushidocodes changed the title Implement PATCH behavior for edit behavior Implement PATCH behavior for user edit behavior Nov 13, 2019
@bushidocodes bushidocodes changed the title Implement PATCH behavior for user edit behavior Implement PATCH behavior for user edits Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant