Skip to content

fix: forward path-parameter model name for OpenAPI http_client operations#396

Merged
jonaslagoni merged 1 commit into
mainfrom
fix/openapi-http-client-readme-parameters
Jul 9, 2026
Merged

fix: forward path-parameter model name for OpenAPI http_client operations#396
jonaslagoni merged 1 commit into
mainfrom
fix/openapi-http-client-readme-parameters

Conversation

@ALagoni97

Copy link
Copy Markdown
Contributor

Problem

For OpenAPI inputs, the http_client channels generator pushed every operation into renderedFunctions with a hardcoded parameterType: undefined (src/codegen/generators/typescript/channels/openapi.ts). It forwarded messageType/replyType but dropped the path-parameter information entirely.

Downstream consumers rely on parameterType to know whether an operation requires a parameters argument. In particular, README generation (in the platform-and-services library) uses it to decide whether to show a parameters line in the usage example and to pick a genuinely argument-free "primary" example.

Because it was always undefined, the generated README could:

  • advertise a call that omits the required parameters for path-parameter operations — e.g. getV2ConnectReferenceId for GET /v2/connect/{referenceId} — yielding a snippet that does not type-check (Property 'parameters' is missing in type … but required in type 'GetV2ConnectReferenceIdContext'); and
  • select such an operation as the "simple" primary example, since every operation looked parameter-free.

The functions themselves were always exported correctly — this is purely about the metadata that drives documentation/examples.

Fix

  • Add parameterType?: string to HttpRenderType and populate it in renderHttpFetchClient with the parameter model name (channelParameters?.name) when the operation declares path parameters.
  • Forward r.parameterType (instead of undefined) through renderedFunctions in the OpenAPI channels generator.

Operations without path parameters continue to report undefined.

Verification

  • npm run typecheck — clean.
  • npm test -- --testPathPattern=channels.spec — 13 passed, snapshots unchanged.
  • Added a regression assertion to the existing OpenAPI http_client test: a path-parameter operation (findPetsByStatusAndCategory) now exposes parameterType: 'FindPetsByStatusAndCategoryParameters', while a parameter-free operation reports undefined.
  • End-to-end against a real OpenAPI spec: the generated README now selects an operation with no required path parameters as the primary example and labels required payload/parameters correctly, instead of silently dropping a required parameters argument.

🤖 Generated with Claude Code

…ions

OpenAPI http_client operations always reported `parameterType: undefined` in
their rendered-function metadata, so downstream consumers had no way to know
which operations require a `parameters` argument.

README generation depends on this signal: when it is missing, the generated
usage example omits the required `parameters` for path-parameter operations
(e.g. `getV2ConnectReferenceId` for `GET /v2/connect/{referenceId}`), producing
a snippet that does not type-check, and it can pick such an operation as the
"simple" primary example.

Populate `HttpRenderType.parameterType` with the generated parameter model name
when the operation declares path parameters, and forward it through
`renderedFunctions` in the OpenAPI channels generator. Operations without path
parameters continue to report `undefined`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ALagoni97 ALagoni97 requested a review from jonaslagoni as a code owner July 8, 2026 17:10
@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
the-codegen-project Ready Ready Preview, Comment Jul 8, 2026 5:12pm
the-codegen-project-mcp Ready Ready Preview, Comment Jul 8, 2026 5:12pm

@jonaslagoni jonaslagoni merged commit 1620c1f into main Jul 9, 2026
16 checks passed
@jonaslagoni

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.72.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants