fern icon indicating copy to clipboard operation
fern copied to clipboard

feat(typescript): add 'always' value to inlinePathParameters feature flag

Open devin-ai-integration[bot] opened this issue 1 month ago • 4 comments

Description

Refs https://buildwithfern.slack.com/archives/C05J55L8JES/p1762839132777439

Expands the inlinePathParameters feature flag in the TypeScript SDK generator to support an "always" value that forces inlining of path parameters into the request object, while maintaining backwards compatibility with existing true/false behavior.

Context: Deep Singhvi questioned why a TypeScript SDK function only takes a string parameter when inlinePathParameters defaults to true. The existing true value only inlines path parameters when certain request shape conditions are met. The new "always" value forces inlining regardless of request shape.

Devin session: https://app.devin.ai/sessions/d62ff3377ad24507861d5f12b30c98a2

Changes Made

  • Updated TypescriptCustomConfigSchema to accept boolean | "always" for inlinePathParameters
  • Updated type definitions across SDK generator, contexts, and custom config interfaces
  • Fixed RequestWrapperContextImpl.shouldInlinePathParameters() to check for null sdkRequest before checking for "always" (critical fix: can't inline into a request object that doesn't exist)
  • Added type coercion in dynamic snippets generator to convert "always" to boolean at the boundary
  • Added new seed test fixture path-parameters:inline-path-parameters-always to validate the new behavior

Testing

  • [x] Seed test fixture added for inlinePathParameters: "always"
  • [x] All CI checks passing (91 passing, 0 failures)
  • [x] Backwards compatibility verified (existing true/false values still work)

Review Focus

Critical logic change: In RequestWrapperContextImpl.shouldInlinePathParameters(), the order of checks matters. We now check sdkRequest == null first, before checking for "always". This is because when there's no request object, we cannot inline path parameters into it, even if "always" is set. In that case, path parameters become direct function parameters instead.

Type boundary: The dynamic snippets generator expects boolean but the config now allows "always". Type coercion is applied at the boundary to convert "always"true.

Semantics: In this codebase, "inline path parameters" means "include path parameters in the request object" (not "inline as direct function parameters"). The "always" value forces this behavior regardless of request shape conditions.

🤖 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

Add a new seed.yml output folder with this new flag and run seed on it

Swimburger avatar Nov 11 '25 17:11 Swimburger

I've added the new seed test fixture for path-parameters with outputFolder: inline-path-parameters-always and customConfig: { inlinePathParameters: "always" } to seed/ts-sdk/seed.yml.

The seed test baseline will be automatically generated by the CI workflow. The TypeScript SDK tests will run against this new fixture and the update-seed.yml workflow will generate the expected output if needed.

I've also fixed the compilation errors by converting the "always" value to boolean at the boundary in the dynamic snippets generator, ensuring backwards compatibility.

The code looks poorly architected, take a step back and clean it up.

Swimburger avatar Nov 12 '25 04:11 Swimburger

This PR is stale because it has been open 25 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Dec 08 '25 02:12 github-actions[bot]