Skip to content

feat(typescript): add serverUrlVariables config flag to opt out of server URL variables#17124

Open
willkendall01 wants to merge 2 commits into
mainfrom
feat/ts-server-url-variables-flag
Open

feat(typescript): add serverUrlVariables config flag to opt out of server URL variables#17124
willkendall01 wants to merge 2 commits into
mainfrom
feat/ts-server-url-variables-flag

Conversation

@willkendall01

@willkendall01 willkendall01 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new serverUrlVariables boolean config flag (default true) to the TypeScript v1 SDK generator.

  • When true (default) or unset: behavior is unchanged. Server URL variables declared on the API's environments are exposed as optional client-constructor options and interpolated into the base URL(s) at construction time.
  • When false: the generator opts out of the feature entirely. It emits neither the server-URL-variable client options nor the templated base-URL interpolation, falling back to the pre-feature base-URL behavior.

Implementation

The flag is declared as serverUrlVariables?: boolean in the shared custom-config zod schema, mirrored on the parsed SdkCustomConfig interface, defaulted to true at parse time, and threaded through SdkGenerator.Config into the two generators that emit server-URL-variable output.

Both emission points (the client-options interface and the construction-time interpolation) route through a single helper, getServerVariableOptions. The gate lives there: when the flag is false it returns an empty list, which suppresses both the options and the interpolation at one narrow point.

Tests

  • Added a direct unit test on the gate helper covering both enabled (default/explicit true) and disabled (false) states.
  • Added generator tests asserting the interpolation is suppressed for both single- and multiple-base-URL environments when the flag is false, alongside the existing tests that confirm default (true) output is unchanged.

Generated with Claude Code


Open in Devin Review

… URL variables

Adds a `serverUrlVariables` config flag (default true) to the TypeScript v1
SDK generator. When false, the generated client no longer exposes the
server-URL-variable constructor options nor the construction-time URL-template
interpolation, falling back to the pre-feature base-URL behavior. When unset or
true, behavior is unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>

@nitpickybot nitpickybot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI Review Summary

Clean, well-scoped feature addition threading a new serverUrlVariables config flag through the TS SDK generator. Logic and tests look correct. One minor issue in the changelog date.

  • 🔵 1 suggestion(s)

interpolation is omitted, falling back to the pre-feature base-URL behavior. When
unset or `true`, behavior is unchanged.
type: feat
createdAt: "2026-07-16"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 suggestion

createdAt: "2026-07-16" is in the future (2026). Likely meant to be 2025 (or whatever today actually is).

Suggested change
createdAt: "2026-07-16"
createdAt: "2025-07-16"

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@willkendall01 willkendall01 changed the title feat(ts-sdk): add serverUrlVariables config flag to opt out of server URL variables feat(typescript): add serverUrlVariables config flag to opt out of server URL variables Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

SDK Generation Benchmark Results

Comparing PR branch against median of 5 nightly run(s) on main (latest: 2026-07-16T05:00:50Z).

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
ts-sdk square 131s (n=5) 131s (n=5) 129s -2s (-1.5%)

main (generator): generator-only time via --skip-scripts (includes Docker image build, container startup, IR parsing, and code generation — this is the same Docker-based flow customers use via fern generate). main (E2E): full customer-observable time including build/test scripts (nightly baseline, informational). Delta is computed against generator-only baseline.
⚠️ = generation exited with a non-zero exit code (timing may not reflect a successful run).
Baseline from nightly runs on main (latest: 2026-07-16T05:00:50Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-07-17 04:50 UTC

Adds a `disable-server-url-variables` variant (customConfig serverUrlVariables:
false) to the server-url-templating and server-url-templating-single-url seed
fixtures. The generated BaseClient.ts confirms that, with the flag disabled, the
server-URL-variable client options and the templated base-URL interpolation are
omitted. The existing no-custom-config snapshots are unchanged, proving the
default behavior is preserved.

Co-Authored-By: Claude <noreply@anthropic.com>
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.

1 participant