Omitted Field Is Cleared During Partial Order Update
Level 1 · node · Correctness · Partial update merge error
Scenario
An order-management API supports partial updates to the delivery note and assignee code. A request that changes only the delivery note returns 200, but operations reports that the omitted assignee code becomes null and the existing assignment is lost. The controller, update service, and repository are separated, and PATCH semantics require changing only fields supplied by the client.
Requirements
- Updating only deliveryNote preserves the existing assigneeCode - Updating only assigneeCode preserves the existing deliveryNote - Supplying both fields updates both values - A field explicitly supplied as null can be changed to null - Updating a nonexistent order returns 404
Acceptance criteria
- A request updating only deliveryNote preserves the existing assigneeCode
- A request updating only assigneeCode preserves the existing deliveryNote
- Supplying both fields updates both values
- An explicit null changes that field to null
- Updating a nonexistent order returns 404