Skip to content

docs(rest): clarify PATCH is a shallow top-level merge (nested objects replaced, not deep-merged)#547

Open
kriszyp wants to merge 4 commits into
mainfrom
kris/doc-schema-patch-gotchas
Open

docs(rest): clarify PATCH is a shallow top-level merge (nested objects replaced, not deep-merged)#547
kriszyp wants to merge 4 commits into
mainfrom
kris/doc-schema-patch-gotchas

Conversation

@kriszyp

@kriszyp kriszyp commented Jun 25, 2026

Copy link
Copy Markdown
Member

What

Adds a warning to the REST PATCH reference clarifying that the merge is shallow (top-level only): a PATCH whose body contains a nested object replaces that whole sub-object rather than deep-merging it, so untouched nested properties are silently dropped.

Why

The current text ("merging only the provided properties... Unspecified properties are preserved") is accurate for top-level attributes but reads as a deep merge. In practice PATCH { "settings": { "theme": "dark" } } drops settings.notifications — a silent data-loss footgun, since the request returns 204 with no indication anything was lost. This came up during exploratory QA (qa-explorer): a single nested-field PATCH silently loses sibling nested data on both engines, with no error and no public docs describing the behavior.

The behavior itself is consistent (RFC 7386-style top-level merge) — this PR just documents it and points to the safe pattern (read-modify-write the parent, or send the full nested object). Also notes that dot-path keys are stored literally.

— KrAIs (Claude) on Kris's behalf

@kriszyp
kriszyp requested a review from a team as a code owner June 25, 2026 14:53

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the REST API overview documentation to add a warning explaining that PATCH requests perform a shallow merge, meaning nested objects are replaced rather than deep-merged. The reviewer suggested formatting this warning with bullet points and clear examples to improve readability and make the behavior easier for developers to understand.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread reference/rest/overview.md Outdated
@github-actions
github-actions Bot temporarily deployed to pr-547 June 25, 2026 14:56 Inactive
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-547

This preview will update automatically when you push new commits.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

@dawsontoth dawsontoth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Content looks good! I like the example. Once the format is happy, I think this'll be good to go!

@Ethan-Arrowood Ethan-Arrowood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Content looks great — this is a real footgun worth documenting, and the example makes it immediately clear. Echoing @dawsontoth: good to go once the format is happy.

The CI failure is caused by this diff (not a flake): bare JSON braces in MDX text. I've attached a one-click suggestion below that fixes the build and the prettier check (verified both locally). Approving on that basis — apply the suggestion and merge at your discretion once it's green.

sent with Claude Fable 5

Comment thread reference/rest/overview.md
Wrap the inline JSON snippets in the PATCH shallow-merge example with
backticks. Raw `{...}` outside a code span is parsed by MDX as a JS
expression, which broke the build ("Could not parse expression with
acorn"); the missing backticks also failed Prettier's format check.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions
github-actions Bot requested a deployment to pr-547 July 20, 2026 00:51 Abandoned
Co-authored-by: Ethan Arrowood <ethan@arrowood.dev>
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-547

This preview will update automatically when you push new commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants