Skip to content

docs(openapi, upgrade): document the public API with JSDoc and docs links - #7811

Merged
KATT merged 2 commits into
cursor/server-jsdoc-d5a5from
cursor/openapi-jsdoc-d5a5
Nov 2, 2026
Merged

KATT merged 2 commits into
cursor/server-jsdoc-d5a5from
cursor/openapi-jsdoc-d5a5

Conversation

@KATT

@KATT KATT commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Why

Some @trpc/openapi exports had no summary or docs link. The @trpc/upgrade codemods had no docs at all.

What

  • @trpc/openapi:
    • generateOpenAPIDocument gets an example and links to /docs/openapi#programmatic.
    • GenerateOptions and the OpenAPIV3_1 namespace get summaries.
    • The /heyapi types and configureTRPCHeyApiClient / createTRPCHeyApiTypeResolvers get summaries and links to their headings.
  • @trpc/upgrade: the hooksToOptions and provider transforms get summaries and link to /docs/client/tanstack-react-query/migrating#codemod-migration.
  • No runtime or type changes.

This is stacked on #7809, which adds the link check. It's one of one-PR-per-package. @trpc/upgrade is two small comments, so it shares this PR.

Links

None. No docs pages change.

Alternatives considered

None.

Testing

  • www/build/package-links.test.ts checks every new link against the v11 pages and headings.
  • pnpm test -- --watch false, pnpm typecheck-packages, pnpm lint, pnpm format, pnpm build && pnpm verify-packed pass.
Open in Web Open in Cursor 

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Documentation
    • Expanded guidance for generating OpenAPI documents, including a usage example and links to related documentation.
    • Added documentation for OpenAPI types, client configuration options, and migration transforms.

@KATT
KATT requested a review from a team as a code owner November 2, 2026 12:37
@vercel

vercel Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

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

8 Skipped Deployments
Project Deployment Actions Updated
trpc-v12 Ignored Ignored Preview Nov 2, 2026 5:09pm UTC
examples-next-minimal-starter Skipped Skipped Nov 2, 2026 5:09pm UTC
examples-todomvc Skipped Skipped Nov 2, 2026 5:09pm UTC
next-prisma-starter Skipped Skipped Nov 2, 2026 5:09pm UTC
next-prisma-websockets-starter Skipped Skipped Nov 2, 2026 5:09pm UTC
tanstack-start-sse-chat Skipped Skipped Nov 2, 2026 5:09pm UTC
trpc-next-app-dir Skipped Skipped Nov 2, 2026 5:09pm UTC
www Skipped Skipped Nov 2, 2026 5:09pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
Commits

Reviewing files that changed from the base of the PR and between ada4969 and 6295e4f.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 6051c85 and 55779f8.

Files selected for processing: 5
  • packages/openapi/src/generate.ts
  • packages/openapi/src/heyapi/index.ts
  • packages/openapi/src/index.ts
  • packages/upgrade/src/transforms/hooksToOptions.ts
  • packages/upgrade/src/transforms/provider.ts

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

Walkthrough

This change adds documentation comments, usage guidance, and documentation links for OpenAPI generation, Hey API configuration, and upgrade transforms. It does not change runtime behavior or public declarations.

Changes: OpenAPI documentation

Layer / File(s) Summary
OpenAPI API and configuration documentation
packages/openapi/src/generate.ts, packages/openapi/src/index.ts, packages/openapi/src/heyapi/index.ts
Documentation now describes generateOpenAPIDocument, its options and example, the returned OpenAPI 3.1 document types, and Hey API transformer and client configuration types. It also adds links to the relevant documentation.

Upgrade transform documentation

Layer / File(s) Summary
Upgrade transform descriptions
packages/upgrade/src/transforms/hooksToOptions.ts, packages/upgrade/src/transforms/provider.ts
Documentation now describes the hook-call rewrites and provider migration performed by the transforms, with links to the migration guide.

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

Change: Other

Possibly related PRs

  • trpc/trpc#7283: Changes the OpenAPI API documented here, including generateOpenAPIDocument and its exported types.
  • trpc/trpc#7298: Changes the Hey API types and client configuration documented here.
  • trpc/trpc#7809: Adds the documentation-link validation that checks links added here.

Suggested reviewers: nick-lucas

Merge Risk: Minimal · previous review 55779

No actionable merge-blocking risk is identified; the PR is documentation-only.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding JSDoc and documentation links for the public APIs in the OpenAPI and upgrade packages.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 5 files.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • 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

@cursor

cursor Bot commented Nov 2, 2026

Copy link
Copy Markdown

@coderabbitai review

@pkg-pr-new

pkg-pr-new Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@trpc/client

npm i https://pkg.pr.new/@trpc/client@7811

@trpc/next

npm i https://pkg.pr.new/@trpc/next@7811

@trpc/openapi

npm i https://pkg.pr.new/@trpc/openapi@7811

@trpc/react-query

npm i https://pkg.pr.new/@trpc/react-query@7811

@trpc/server

npm i https://pkg.pr.new/@trpc/server@7811

@trpc/tanstack-react-query

npm i https://pkg.pr.new/@trpc/tanstack-react-query@7811

@trpc/upgrade

npm i https://pkg.pr.new/@trpc/upgrade@7811

commit: 6295e4f

@trpc-bot

trpc-bot commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cursor
cursor Bot requested a review from a team as a code owner November 2, 2026 16:00
@cursor
cursor Bot force-pushed the cursor/openapi-jsdoc-d5a5 branch from e0de504 to ada4969 Compare November 2, 2026 16:00
@vercel
vercel Bot temporarily deployed to Preview – examples-todomvc November 2, 2026 16:00 Inactive
@vercel
vercel Bot temporarily deployed to Preview – examples-next-minimal-starter November 2, 2026 16:00 Inactive
@vercel
vercel Bot temporarily deployed to Preview – next-prisma-starter November 2, 2026 16:00 Inactive
@vercel
vercel Bot temporarily deployed to Preview – www November 2, 2026 16:00 Inactive
@vercel
vercel Bot temporarily deployed to Preview – trpc-next-app-dir November 2, 2026 16:00 Inactive
@cursor
cursor Bot changed the base branch from cursor/jsdoc-links-check-d5a5 to cursor/server-jsdoc-d5a5 November 2, 2026 16:00
@KATT
KATT added this pull request to stack #7825 November 2, 2026 16:02
@trpc-bot

trpc-bot commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor
Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

trpc-bot
trpc-bot previously approved these changes Nov 2, 2026

@trpc-bot trpc-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is green and CodeRabbit has no open findings at this head.

@cursor
cursor Bot force-pushed the cursor/openapi-jsdoc-d5a5 branch from ada4969 to 6295e4f Compare November 2, 2026 17:09
@vercel
vercel Bot temporarily deployed to Preview – trpc-next-app-dir November 2, 2026 17:09 Inactive
@vercel
vercel Bot temporarily deployed to Preview – next-prisma-starter November 2, 2026 17:09 Inactive
@vercel
vercel Bot temporarily deployed to Preview – examples-todomvc November 2, 2026 17:09 Inactive
@vercel
vercel Bot temporarily deployed to Preview – examples-next-minimal-starter November 2, 2026 17:09 Inactive
@vercel
vercel Bot temporarily deployed to Preview – www November 2, 2026 17:09 Inactive

@trpc-bot trpc-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased onto main after #7822. CI is green and CodeRabbit has no open findings at this head.

@KATT
KATT added this pull request to the merge queue Nov 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue because a pull request earlier in the stack was removed Nov 2, 2026
@KATT
KATT added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 263b6d1 Nov 2, 2026
52 checks passed
@KATT
KATT deleted the cursor/openapi-jsdoc-d5a5 branch November 2, 2026 21:21
meefs pushed a commit to meefs/trpc that referenced this pull request Nov 2, 2026
…sources (trpc#7809)

<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
## Why

- The missing-transformer type error said "on your your
`initTRPC`-object".
- Many `trpc.io/docs` links in `packages/*/src` used old paths
(`/docs/v11/...`, `http://`, moved Next.js pages). Nothing caught them.

## What

- Fix the message to match the docs quote: ``You must define a
transformer on your `initTRPC`-object first``. A type test in
`packages/tests/server/transformer.test.ts` asserts the exact text.
- Point every existing docs link in package sources at its current v11
page (16 files).
- Add `www/build/package-links.test.ts`. It runs in CI through `pnpm
--filter www test`. It fails when a `trpc.io/docs` link in
`packages/*/src`:
  - isn't the canonical `https://trpc.io/docs/...` form,
- isn't a v11 docs page (slugs come from the site's own `docPages()`),
or
- has an `#anchor` that isn't a heading on that page (ids come from the
site's own `anchorsOf()`, so `{#id}` overrides count).

This is the base of a stack. The JSDoc work is split into one PR per
package, each based on this branch:

- trpc#7810 `@trpc/server`
- trpc#7814 `@trpc/client`
- trpc#7813 `@trpc/react-query` (deprecated: bug fixes only, removed in the
next major)
- trpc#7815 `@trpc/tanstack-react-query`
- trpc#7812 `@trpc/next` (deprecated in favor of
`@trpc/tanstack-react-query`)
- trpc#7811 `@trpc/openapi` and `@trpc/upgrade`

## Links

None. No docs pages change.

## Alternatives considered

- A script in `scripts/`: it would have to copy the site's slug and
heading-id rules. The www test reuses them, so it matches the built
routes.

## Testing

- `pnpm test -- --watch false`, `pnpm --filter www test`, `pnpm
typecheck-packages`, `pnpm lint`, `pnpm format`, `pnpm build && pnpm
verify-packed` all pass.
- I checked that the link test fails on a bad page and on a bad anchor.

<!-- CURSOR_AGENT_PR_BODY_END -->

<div><a
href="https://cursor.com/agents/bc-582c9e70-feeb-562d-989d-e010a7eed5a5?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/background-agent?bcId=bc-582c9e70-feeb-562d-989d-e010a7eed5a5&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

<!-- codesmith:footer -->
---
<a
href="https://app.blacksmith.sh/trpc/codesmith/trpc/pr/7809?autoLogin=true&ref=codesmith_pr_footer"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v3.svg"><img
alt="View with [code]smith"
src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png"
width="162" height="28"></picture></a> <a
href="https://backend.blacksmith.sh/track/enable-autofix?expires=1796215022&installation_model_id=443568&pr_number=7809&ref=codesmith_pr_footer&repository=trpc%2Ftrpc&return_to=https%3A%2F%2Fgithub.com%2Ftrpc%2Ftrpc%2Fpull%2F7809&signature=d5f54bfe70dbaca02e62f8e232c205f9e96577f47476b138ea711f417dad2882"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img
alt="Autofix with [code]smith"
src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png"
width="190" height="28"></picture></a>
<sup>Need help on this PR? Tag <code>@codesmith-bot</code> with what you
need.</sup>

<!-- codesmith:autofix:disabled -->
<!-- /codesmith:footer -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

- **Documentation**
- Updated links across client, React, Next.js, TanStack Query, and
server references to current documentation paths and secure HTTPS URLs.
  - Corrected a typo in a transformer-related error message.

- **Tests**
- Added checks for documentation link formats and heading references,
and expanded transformer type coverage.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Cursor Agent <[email protected]>
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 4, 2026

This branch was previously deployed

5 inactive deployments
Preview – www — 6295e4f6 Deployed Nov 2, 2026 by vercel[bot]
Preview – examples-next-minimal-starter — 6295e4f6 Deployed Nov 2, 2026 by vercel[bot]
Preview – examples-todomvc — 6295e4f6 Deployed Nov 2, 2026 by vercel[bot]
Preview – next-prisma-starter — 6295e4f6 Deployed Nov 2, 2026 by vercel[bot]
Preview – trpc-next-app-dir — 6295e4f6 Deployed Nov 2, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants