fix: Preserve explicit nil in request bodies as JSON null - #522
Conversation
base_client no longer strips nil from mutating request bodies, so an explicit nil survives as JSON null. This is the hand-maintained runtime half of the nullable-clearing feature; the generated methods that pass nullable fields through arrive via regeneration from oagen-emitters#189.
Original prompt from heather
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Description
Hand-maintained runtime half of the cross-SDK nullable-clearing feature. Touches only the
@oagen-ignore-filelib/workos/base_client.rb(plus a test), so it won't be auto-closed byworkos-sdk-automation.base_clientpreviously ranbody.compact.to_jsonon every POST/PUT/PATCH/DELETE body, which strips everynil— so an explicitnilon a nullable field (e.g.external_id) could never reach the wire as JSONnull. This drops the.compact:Omission ("leave unchanged") is not affected: it's handled upstream in the generated methods, which build the body with
.compacton the non-nullable literal and only conditionally assign nullable fields via aWorkOS::OMITsentinel default. Those generated changes come from regeneration against workos/oagen-emitters#189; this PR is the runtime prerequisite. On its own it's a safe no-op against today's generated code (which already pre-compacts its bodies), and it enables the feature once regeneration lands.Verified no existing hand-maintained caller relied on
base_clientto strip its nils (full suite green, 694 runs).Testing
Added
test_base_clientcases asserting POST/PUT serialize an explicitnilvalue as JSONnull.Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.
Link to Devin session: https://app.devin.ai/sessions/127c630f46c54bc0be571814c75047e8