Skip to content

feat(openapi): Add better support for x-fern-base-path#15998

Merged
amckinney merged 26 commits into
mainfrom
amckinney/x-fern-base-path-ext
May 20, 2026
Merged

feat(openapi): Add better support for x-fern-base-path#15998
amckinney merged 26 commits into
mainfrom
amckinney/x-fern-base-path-ext

Conversation

@amckinney
Copy link
Copy Markdown
Contributor

This adds a new structured syntax for x-fern-base-path which allows users to specify path parameters defined at the root of the client. Unlike x-fern-sdk-variables, this allows users to maintain their standard OpenAPI path mapping, and clearly communicate that the path parameters should be hoisted up and not reproduded at the endpoint level.

In combination with other request body property types, this results in far better code generation (i.e. we don't need to put request body properties under a separate key).

This also includes the changes for both TypeScript and Python to start using this feature -- all artifacts will be released from this PR.

amckinney added 20 commits May 19, 2026 23:08
…parameterized; collapse body-only request to scalar shorthand
When set to true, the OpenAPI importer expects every path in paths: to
begin with the literal base-path prefix and strips it on import. Operation-
level path-parameter declarations for parameters that appear in the base
path are also dropped to avoid stutter. This lets users keep their OpenAPI
paths intact (e.g. /{apiVersion}/widgets) while the generated Fern
Definition emits the clean form (base-path: /{apiVersion}, endpoint
path: /widgets).
Previously buildUrl in convertExampleEndpointCall.ts only substituted
placeholders when the user example included a path-parameters block.
For endpoints whose path parameters are declared at the root API file
level but not repeated in per-endpoint examples, the example URL kept
the literal placeholder.

Now buildUrl always runs the user-example substitution, then a second
fallback pass replaces any remaining placeholder with its name. This
matches what generator constructor blocks emit for unfilled root path
parameters, so mock URLs in generated wire tests align with what the
SDK actually requests.
@amckinney amckinney requested a review from Swimburger as a code owner May 20, 2026 03:14
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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 20, 2026

Docs Generation Benchmark Results

Comparing PR branch against median of 5 nightly run(s) on main (latest: 2026-05-19T05:19:53Z).

Fixture main PR Delta
docs 219.6s (n=5) 211.6s (35 versions) -8.0s (-3.6%)

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-05-19T05:19:53Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-05-20 04:22 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 20, 2026

SDK Generation Benchmark Results

Comparing PR branch against median of 5 nightly run(s) on main (latest: 2026-05-19T05:19:53Z).

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
csharp-sdk square 69s (n=5) 105s (n=5) 61s -8s (-11.6%)
go-sdk square 133s (n=5) 278s (n=5) 129s -4s (-3.0%)
java-sdk square 206s (n=5) 252s (n=5) 221s +15s (+7.3%)
php-sdk square 54s (n=5) 81s (n=5) 52s -2s (-3.7%)
python-sdk square 133s (n=5) 232s (n=5) 124s -9s (-6.8%)
ruby-sdk-v2 square 90s (n=5) 118s (n=5) 87s -3s (-3.3%)
rust-sdk square 167s (n=5) 163s (n=5) 158s -9s (-5.4%)
swift-sdk square 52s (n=5) 739s (n=5) 50s -2s (-3.8%)
ts-sdk square 230s (n=5) 235s (n=5) 220s -10s (-4.3%)

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-05-19T05:19:53Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-05-20 04:24 UTC

@amckinney amckinney merged commit 1c9ef5f into main May 20, 2026
197 of 199 checks passed
@amckinney amckinney deleted the amckinney/x-fern-base-path-ext branch May 20, 2026 04:07
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