aip-dev / google.aip.dev

API Improvement Proposals. https://aip.dev/
Other
1.08k stars 495 forks source link

AIP-134: Update masks should not be optional #1402

Open SLaks opened 2 months ago

SLaks commented 2 months ago

Problem

  1. Client Foo does not include an update mask
  2. Server introduces a new optional field bar
  3. User sets bar on a newer client
  4. User updates the containing object via an older build of client Foo that does not know about bar.
  5. The update RPC does not include bar (eg, because it uses read masks and didn't request it, or because it drops unknown fields.
  6. The bar field is silently cleared

Solution

Change https://linter.aip.dev/134/update-mask-optional-behavior and The field must be optional, and the service must treat an omitted field mask as an implied field mask equivalent to all fields that are populated (have a non-empty value). to make update masks always required.