Relationships
#2656 Codegen: PUT updates clear optional fields that global arguments leave unset
Opened by stack72 · 9/28/2026
Generated models whose update is a full-replacement PUT build the request body only from the fields set in global arguments. Any optional field left unset is omitted from the PUT, so the provider clears it (or resets it to its default). For example, a Cloudflare model with a PUT update and an optional description: running update with only the scope argument and one changed field wipes the existing description.
This predates swamp-club #2645. That fix fills only create-required fields of Cloudflare PUT updates from a GET of the live resource. It does not fill optional fields, to keep that change scoped. The same pattern applies to every generator that builds PUT bodies from set global arguments only: Hetzner (always PUT), DigitalOcean and Vercel (PUT fallback), and GCP.
Suggested fix: for PUT updates, fill every unset update-body field from the live resource (as #2645 does for create-required fields), so an unset field means keep the current value.
Closed
No activity in this phase yet.
stack72 commented 9/29/2026, 11:23:41 AM
Closed out: fixed in https://git.swamp-club.com/swamp-club/swamp-extensions/pulls/349 (merged and published, tracked under the #2662 lifecycle). Full-replacement PUT updates in the GCP, Cloudflare, DigitalOcean and Vercel generators now fill every update-body field left unset in global arguments from a GET of the live resource, so an unset field keeps its current value. Fields are copied only when the response has the same shape as the request, and never when described as output-only or named like a secret (those must be set explicitly). Hetzner is unchanged: its PUT only updates the fields sent, so the problem does not apply there.
Sign in to post a ripple.