feat(ir): carry path parameter clientDefault into dynamic IR NamedParameter#16665
feat(ir): carry path parameter clientDefault into dynamic IR NamedParameter#16665devin-ai-integration[bot] wants to merge 7 commits into
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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 |
Description
Additive dynamic-IR change so dynamic-snippet generators can distinguish an optional (client-default) path parameter from a required one.
This is step 1 of 2 toward fixing the php-sdk
api-wide-base-path-with-defaultseedallowedFailuresentry. Today an api-wide base-path parameter withx-fern-default(e.g.apiVersion: v1beta) carries aclientDefaultin the full IR, which makes the generated SDK treat it as optional and order it after the request body:But the dynamic snippet emits it as a required positional arg before the body (
create('v1beta', new Widget([...]))), producing a phpstan type mismatch. The root cause is that the dynamic IR'sNamedParametercarriedvariablebut droppedclientDefault, so the snippet generator had no signal that the param is optional/reorderable.The generator-side reordering fix is a separate follow-up PR that can only land after this IR change publishes (
@fern-fern/ir-sdk/@fern-api/dynamic-ir-sdk), since generators consume the published IR SDK — they cannot read a field that doesn't yet exist in the published type. This PR therefore does not touchseed/php-sdk/seed.ymlor remove theallowedFailuresentry.Changes Made
clientDefault: optional<LiteralType>to the dynamic IR'sNamedParameterinpackages/ir-sdk/fern/apis/ir-types-latest/definition/dynamic/types.yml; regenerate the IR SDK (pnpm ir:generate).DynamicSnippetsConverter.convertPathParameters(reusing the existingconvertLiteralhelper):this.ir.pathParameters(api-wide root params), so the base-pathapiVersionparam now carries itsclientDefaultinto the dynamic IR. The IR SDK is generated withnoOptionalProperties, so all otherNamedParameterconstruction sites in the converter were updated to setclientDefault: undefined.packages/ir-sdk/fern/apis/ir-types-latest/VERSIONto67.7.0(minor for an additive optional field) and add an IRCHANGELOG.mdentry.67.6.0shipped independently onmainforspecVersion, so this change resolves the merge by taking the next minor.packages/cli/cli/changes/unreleased/.@fern-api/ir-generator-testsdynamic-IR / full-IR snapshot fixtures (additiveclientDefaultonly) and update thefile-dependenciesIR-length ete snapshot (2297979→2298004) to account for bothspecVersion(frommain) andclientDefault.Testing
pnpm compile(160/160 packages) andpnpm run check(biome) pass with the new field.@fern-api/ir-generator-testssuite passes. The regenerated dynamic-IR snapshot for the target fixture now carries the field on the base-path param:"clientDefault": null.test-eteand all seed suites.Follow-up (after this publishes): bump the php dynamic-snippets generator's IR deps, order root path params by
clientDefault != nullto match the SDK signature, regenerate the fixture, and removeapi-wide-base-path-with-defaultfromseed/php-sdk/seed.yml.Link to Devin session: https://app.devin.ai/sessions/f75b71a1feab408dbe95a9e698500465