Skip to content

fix(typescript): resolve query parameter name conflicts stripping body properties#14238

Merged
tstanmay13 merged 3 commits intomainfrom
devin/1774633530-fix-query-param-name-conflict-body-stripping
Mar 30, 2026
Merged

fix(typescript): resolve query parameter name conflicts stripping body properties#14238
tstanmay13 merged 3 commits intomainfrom
devin/1774633530-fix-query-param-name-conflict-body-stripping

Conversation

@jon-fern
Copy link
Copy Markdown
Contributor

@jon-fern jon-fern commented Mar 27, 2026

Description

Refs https://github.com/fern-demo/close-typescript-sdk/pull/5

Fixes a bug where request body properties were silently stripped from generated SDK client methods when resolveQueryParameterNameConflicts is enabled and query parameter wire names collide with body property names.

Root Cause

getNonBodyKeys and getNonBodyKeysWithData in GeneratedRequestWrapperImpl.ts always called getPropertyNameOfQueryParameter, which returns { propertyName: wireValue, safeName }. For colliding query params, this produced a destructuring pattern like:

const { assigned_to: filterAssignedTo, is_complete: filterIsComplete, ..._body } = request;

This extracts the body properties assigned_to and is_complete (by their wire names), removing them from the ..._body spread — so the request body is sent as {}.

Fix

Both methods now check getCollidingQueryParamWireValues (only when resolveQueryParameterNameConflicts is enabled) and use getOverriddenPropertyNameOfQueryParameter for colliding params, which returns { propertyName: overriddenName, safeName }. This produces:

const { filterAssignedTo, filterIsComplete, ..._body } = request;

Body properties like is_complete are no longer extracted and remain in _body.

Changes Made

  • Modified getNonBodyKeys and getNonBodyKeysWithData to use overridden property names for colliding query parameters
  • Added version 3.60.2 to generators/typescript/sdk/versions.yml

Testing

  • All 162 existing unit tests in request-wrapper-generator pass
  • All 538 existing unit tests in client-class-generator pass
  • Verified the unfixed code generates buggy destructuring (assigned_to: filterAssignedTo) and the fixed code generates correct destructuring (filterAssignedTo) by regenerating the query-param-name-conflict seed fixture both with and without the fix

Review Checklist

  • Verify that withQueryParameter / getReferenceToQueryParameter in RequestWrapperParameter.ts still resolve aliases correctly — both getPropertyNameOfQueryParameter and getOverriddenPropertyNameOfQueryParameter share the same safeName, so alias lookup should be unaffected, but worth confirming
  • Confirm getCollidingQueryParamWireValues is only called when resolveQueryParameterNameConflicts is true (gated at lines 519 and 546)
  • Note that getCollidingQueryParamWireValues is now called twice per endpoint (once in each method) — this is harmless for small query param lists but worth noting

Link to Devin session: https://app.devin.ai/sessions/d27799c513934481a4042a6818cffd00
Requested by: @jon-fern

…colliding query params

When resolveQueryParameterNameConflicts is enabled and a query parameter
name collides with a body property name, getNonBodyKeys and
getNonBodyKeysWithData now use the overridden property name (e.g.
filterIsComplete) instead of the wire value (e.g. is_complete).

Previously, the destructuring pattern would extract the body property
by its wire name, causing it to be stripped from the spread into _body.
This resulted in empty request bodies being sent for endpoints with
colliding query param and body property names.

Co-Authored-By: jon <jon@buildwithfern.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

devin-ai-integration Bot and others added 2 commits March 27, 2026 18:01
…ct-body-stripping

Co-Authored-By: jon <jon@buildwithfern.com>
…ct-body-stripping

Co-Authored-By: jon <jon@buildwithfern.com>
@tstanmay13 tstanmay13 merged commit 010b3bb into main Mar 30, 2026
89 checks passed
@tstanmay13 tstanmay13 deleted the devin/1774633530-fix-query-param-name-conflict-body-stripping branch March 30, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants