feat(openapi): Add better support for x-fern-base-path#15998
Conversation
…meters from 3.1 converter
…parameterized; collapse body-only request to scalar shorthand
…apshots for request collapse
…malizeClientOptions
… substitution through wrapper
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.
There was a problem hiding this comment.
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.
Docs Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on
Docs generation runs |
SDK Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on Full benchmark table (click to expand)
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 |
This adds a new structured syntax for
x-fern-base-pathwhich allows users to specify path parameters defined at the root of the client. Unlikex-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.