Skip to content

feat(internal): invocation-only dynamic snippets + clientImport in all SDK generators - #18292

Open
adidavid014 wants to merge 4 commits into
mainfrom
devin/1791987416-invocation-only-dynamic-snippets
Open

adidavid014 wants to merge 4 commits into
mainfrom
devin/1791987416-invocation-only-dynamic-snippets

Conversation

@adidavid014

@adidavid014 adidavid014 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

Linear ticket: n/a

Dynamic snippet generators can now return just the SDK call instead of a full sample. Docs guide templates need this so they can render real SDK code without the author typing imports and client setup for each language.

This revives 9 closed PRs by @cadesark as one PR on current main: #17445 (TypeScript, which adds the shared contract), #17456 (Rust), #17449 (Python), #17450 (C#), #17451 (Java), #17452 (PHP), #17453 (Ruby), #17454 (Swift), #17455 (Go).

generateInvocationSync(request) returns:

  • snippet: the bare call, e.g. client.endpoints.httpMethods.testPut("id")
  • imports: imports for types the call itself references
  • clientName: the generated client class, e.g. AcmeClient
  • clientImport: the import line for that client, e.g. import { AcmeClient } from "acme" (Rust: use acme_api::prelude::*;)

Changes Made

  • Shared base (browser-compatible-base): InvocationSnippetResponse, plus generateInvocationSync on the abstract generators.
  • Per-language generateInvocationSnippetSync, with an AST helper in each language that renders a node without its imports.
  • Ruby: merge conflict resolved against main's SDK-variable change (feat(ruby): SDK variables with env var fallback in the Ruby v2 SDK generator #18035). Only the @fern-api/ruby-ast import line conflicted. Ruby changelog moved to generators/ruby-v2/sdk/changes/unreleased/ (it had been in the legacy generators/ruby folder).
  • One changes/unreleased/invocation-only-dynamic-snippets.yml per generator (feat).
  • No Next.js or docs-platform code is involved. The fern-platform side ships in a separate Astro-only PR after this releases.
  • Updated README.md generator (if applicable)

Testing

  • Unit tests added/updated: InvocationSnippet.test.ts in each dynamic-snippets package.
  • Full vitest run passes for every dynamic-snippets package: TS 55, Rust 16, Python 73, C# 53, Java 46, PHP 48, Ruby 43, Swift 42, Go 117.
  • pnpm turbo run compile --filter='@fern-api/*-dynamic-snippets' (34/34) and biome check on the changed files both pass.
  • Manual testing completed (end-to-end check comes with the fern-platform PR)

Link to Devin session: https://app.devin.ai/sessions/fe9c4016a14d43f2a010ca28288bd4c4
Open in Devin Desktop: https://app.devin.ai/desktop/session/fe9c4016a14d43f2a010ca28288bd4c4?variant=devin
Requested by: @adidavid014


Devin Review

… all SDKs

Combines #17445, #17449, #17450, #17451, #17452, #17453, #17454, #17455, #17456
onto current main (Ruby conflict resolved against SDK-variable changes).

Co-authored-by: Cade Sarkin <cade@buildwithfern.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

nitpickybot[bot]

This comment was marked as resolved.

…oss endpoint candidates

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@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 found 4 potential issues.

Devin Review

Comment thread generators/go-v2/dynamic-snippets/src/EndpointSnippetGenerator.ts
Comment thread generators/csharp/dynamic-snippets/src/EndpointSnippetGenerator.ts
Comment thread generators/swift/dynamic-snippets/src/EndpointSnippetGenerator.ts
Comment thread generators/python-v2/ast/src/python.ts Outdated

@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.

👀 4 findings need your review

Devin reviewed all 4 findings on 3a9e77f and left them for you. Click a finding below to jump to its comment.

For your review (4)

View all findings in Devin Review

Devin Review

…on import; Python alias consistency

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Docs Generation Benchmark Results

Comparing PR branch against median of 5 nightly run(s) on main (latest: 2026-10-14T04:06:14Z).

Fixture main PR Delta
docs 154.7s (n=5) 201.2s (35 versions) +46.5s (+30.1%)

Docs generation runs fern generate --docs --preview end-to-end against the benchmark fixture with 35 API versions (each version: markdown processing + OpenAPI-to-IR + FDR upload).
Delta is computed against the nightly baseline on main.
Baseline from nightly run(s) on main (latest: 2026-10-14T04:06:14Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-10-14 15:56 UTC

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

SDK Generation Benchmark Results

Comparing PR branch against median of 5 nightly run(s) on main (latest: 2026-10-14T04:06:14Z).

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
csharp-sdk square 72s (n=5) 108s (n=5) 91s +19s (+26.4%)
go-sdk square 106s (n=5) 227s (n=5) 138s +32s (+30.2%)
java-sdk square 179s (n=5) 216s (n=5) 218s +39s (+21.8%)
php-sdk square 58s (n=5) N/A 51s -7s (-12.1%)
python-sdk square 123s (n=5) 185s (n=5) 165s +42s (+34.1%)
ruby-sdk-v2 square 76s (n=5) 111s (n=5) 88s +12s (+15.8%)
rust-sdk square 202s (n=5) 171s (n=5) 210s +8s (+4.0%)
swift-sdk square 59s (n=5) 307s (n=5) 66s +7s (+11.9%)
ts-sdk square 139s (n=5) 139s (n=5) 131s -8s (-5.8%)

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-10-14T04:06:14Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-10-14 15:57 UTC

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

This branch has not been deployed

No deployments
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