Skip to content

docs(client, openapi): fix the origin callback arguments in link examples - #2538

Merged
dinwwwh merged 1 commit into
mainfrom
claude/link-callback-arguments-b15a4a
Nov 23, 2026
Merged

dinwwwh merged 1 commit into
mainfrom
claude/link-callback-arguments-b15a4a

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Nov 23, 2026

Copy link
Copy Markdown
Member

What changed

The origin example in the RPC Link and OpenAPI Link docs now uses origin: (options, path) => ....

Why

The examples destructured path from the first argument (({ path, context }) => ...), but origin receives (options, path). Copied as-is, the example is a type error in TypeScript, and in JavaScript path is undefined.

Notes for review

  • Docs only: two lines in apps/content/docs/rpc/link.mdx and apps/content/docs/openapi/link.mdx.
  • Link option callbacks keep their current positional arguments. An earlier attempt to unify them into a single object was dropped.

…ples

The origin examples read path from the first argument, but it is the
second.
@pkg-pr-new

pkg-pr-new Bot commented Nov 23, 2026

Copy link
Copy Markdown
More templates

@orpc/ai-sdk

npm i https://pkg.pr.new/@orpc/ai-sdk@2538

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@2538

@orpc/bun

npm i https://pkg.pr.new/@orpc/bun@2538

@orpc/client

npm i https://pkg.pr.new/@orpc/client@2538

@orpc/cloudflare

npm i https://pkg.pr.new/@orpc/cloudflare@2538

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@2538

@orpc/effect

npm i https://pkg.pr.new/@orpc/effect@2538

@orpc/evlog

npm i https://pkg.pr.new/@orpc/evlog@2538

@orpc/hibernation

npm i https://pkg.pr.new/@orpc/hibernation@2538

@orpc/json-schema

npm i https://pkg.pr.new/@orpc/json-schema@2538

@orpc/experimental-lock

npm i https://pkg.pr.new/@orpc/experimental-lock@2538

@orpc/mcp

npm i https://pkg.pr.new/@orpc/mcp@2538

@orpc/msw

npm i https://pkg.pr.new/@orpc/msw@2538

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@2538

@orpc/next

npm i https://pkg.pr.new/@orpc/next@2538

@orpc/node

npm i https://pkg.pr.new/@orpc/node@2538

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@2538

@orpc/experimental-openapi-inference

npm i https://pkg.pr.new/@orpc/experimental-openapi-inference@2538

@orpc/opentelemetry

npm i https://pkg.pr.new/@orpc/opentelemetry@2538

@orpc/pinia-colada

npm i https://pkg.pr.new/@orpc/pinia-colada@2538

@orpc/pino

npm i https://pkg.pr.new/@orpc/pino@2538

@orpc/publisher

npm i https://pkg.pr.new/@orpc/publisher@2538

@orpc/ratelimit

npm i https://pkg.pr.new/@orpc/ratelimit@2538

@orpc/server

npm i https://pkg.pr.new/@orpc/server@2538

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@2538

@orpc/swr

npm i https://pkg.pr.new/@orpc/swr@2538

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@2538

@orpc/trpc

npm i https://pkg.pr.new/@orpc/trpc@2538

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@2538

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@2538

commit: 6b241e5

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
orpc 6b241e5 Commit Preview URL

Branch Preview URL
Nov 23 2026, 07:48 AM

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Documentation
    • Updated the dynamic origin examples to show the callback receiving request options and the procedure path as separate arguments.
    • Clarified that paths beginning with internal use the internal origin, while other paths use the API origin.

The OpenAPI and RPC link documentation examples now use positional options and path arguments for the dynamic origin callback. The OpenAPI example retains its path-based routing behavior.

Changes: Dynamic origin callback examples

Layer / File(s) Summary
Update callback parameters
apps/content/docs/openapi/link.mdx, apps/content/docs/rpc/link.mdx
Both examples pass options and path as separate callback parameters. The OpenAPI example retains its existing routing behavior.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Other

Merge Risk: Minimal · up to 6b241

This documentation-only change corrects the argument order in the origin callback examples so copied code behaves as intended. It poses no meaningful merge risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the docs fix: the origin callback arguments in the link examples. The raw summary and description confirm the change updates the origin example in the RPC and OpenAPI Link docs from de…
Description check Passed The description states what changed (origin example now uses (options, path) in the RPC and OpenAPI Link docs) and why (the old example read path from the first argument, causing a TypeScript type err…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the docs fix: the origin callback arguments in the link examples. The raw summary and description confirm the change updates the origin example in the RPC and OpenAPI Link docs from destructured {path, context} to positional (options, path). The title matches the main change and uses the conventional docs(scope) format.

Full details: Description check

Explanation

The description states what changed (origin example now uses (options, path) in the RPC and OpenAPI Link docs) and why (the old example read path from the first argument, causing a TypeScript type error or an undefined path in JavaScript). It also notes the docs-only scope and the dropped single-object proposal. This matches the changeset directly.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d4b19cb0-b47f-4ea5-b995-6fc23ac5b821
Commits

Reviewing files that changed from the base of the PR and between 17f758b and 6b241e5.

Files selected for processing: 2

  • apps/content/docs/openapi/link.mdx
  • apps/content/docs/rpc/link.mdx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

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

✅ No new issues found.

Approach: sound — this corrects the examples to the transport's actual positional callback signature instead of reshaping the public option API, which keeps the docs aligned with shipped types.

Reviewed changes

  • RPC link example — origin now declared as (options, path), matching Value<..., [options: ClientOptions<T>, path: string[]]> in packages/client/src/adapters/fetch/transport.ts, where it is resolved via value(this.origin, options, path).
  • OpenAPI link example — same fix; OpenAPILinkOptions extends FetchLinkTransportOptions<T>, so the signature is identical there.
  • Neighbouring examples — verified the headers callback in the same snippets is still correct: headers is invoked with positional (options, path, input), so destructuring { context } from the first argument works. No ({ path, context }) occurrences remain anywhere in the repo.

The snippets are plain ts fences rather than twoslash, so they are not typechecked at docs build time, which is why the mismatch went unnoticed. That is a pre-existing gap rather than something this PR introduces.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 5 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 40 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing claude/link-callback-arguments-b15a4a (6b241e5) with main (17f758b)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@dinwwwh
dinwwwh merged commit 3ebfb98 into main Nov 23, 2026
13 checks passed
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