feat(nest): rename toStandardLazyRequest to toNestStandardLazyRequest with additional params#1611
Conversation
… with additional params
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Code Review
This pull request renames the toStandardLazyRequest option to toNestStandardLazyRequest and introduces the NestStandardLazyRequest interface to support route parameters (params) across different adapters. The feedback suggests correcting the Hono example in the documentation to use req.param() instead of req.params, and fixing a typo and type reference in the JSDoc comments for toNestStandardLazyRequest.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
@orpc/arktype
@orpc/bun
@orpc/client
@orpc/contract
@orpc/experimental-effect
@orpc/evlog
@orpc/interop
@orpc/json-schema
@orpc/nest
@orpc/next
@orpc/openapi
@orpc/opentelemetry
@orpc/pino
@orpc/publisher
@orpc/ratelimit
@orpc/server
@orpc/shared
@orpc/tanstack-query
@orpc/valibot
@orpc/zod
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughRenames the Nest request conversion hook to ChangesNest params support
Estimated code review effort: 2 (Simple) | ~12 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant ImplementInterceptor
participant StandardHandler
Client->>ImplementInterceptor: incoming Nest request (req)
ImplementInterceptor->>ImplementInterceptor: toNestStandardLazyRequest(req, res)
ImplementInterceptor->>StandardHandler: decodeInput(standardRequest)
StandardHandler->>StandardHandler: toORPCOpenAPIParams(procedure, standardRequest.params)
StandardHandler-->>Client: decoded response
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
ℹ️ Minor suggestions only. No functional issues — the rename, new
NestStandardLazyRequesttype, and documented example cover the stated goal.vitest,eslint, andtsc -bfor the Nest package all pass.
Reviewed changes — rename the @orpc/nest request-converter config option and request type so custom adapters can surface route parameters.
- Rename
ORPCModuleConfig.toStandardLazyRequesttotoNestStandardLazyRequestand update the default converter accordingly. - Introduce
NestStandardLazyRequestextendingStandardLazyRequestwith an optionalparamsfield and export it from@orpc/nest. - Assign
req.paramsintostandardRequest.paramsin the default converter and usestandardRequest.paramswhen decoding OpenAPI path parameters. - Update the NestJS integration docs and the custom-parser test case.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/nest/src/implement.ts`:
- Around line 140-149: The path-parameter decoding in implement.ts now depends
only on toNestStandardLazyRequest populating standardRequest.params, which
breaks existing custom converters that only renamed to the new hook. Update the
decodeInput flow in implement() so it preserves backward compatibility by
falling back to the raw request params when standardRequest.params is absent,
using the existing toNestStandardLazyRequest/standardRequest path as the primary
source and req.params as the fallback.
In `@packages/nest/src/module.ts`:
- Around line 24-28: Update the JSDoc on toNestStandardLazyRequest in module.ts
so it matches the current return type name NestStandardLazyRequest and fixes the
wording to “how to convert”; keep the comment aligned with the hook’s purpose
and use the toNestStandardLazyRequest symbol to locate the stale text.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 56bd0a7d-9eb6-48e3-a0d9-06e148bee4e8
📒 Files selected for processing (4)
apps/content/docs/integrations/nest.mdpackages/nest/src/implement.test.tspackages/nest/src/implement.tspackages/nest/src/module.ts
| const standardRequest = this.toNestStandardLazyRequest(req, res) | ||
|
|
||
| const handler = new StandardHandler({ | ||
| resolveProcedure: () => Promise.resolve({ | ||
| path: getPathMeta(procedure) ?? [], | ||
| procedure, | ||
| decodeInput: () => this.codec.decodeInput({ | ||
| procedure, | ||
| params: toORPCOpenAPIParams(procedure, req.params as NestParams), | ||
| params: toORPCOpenAPIParams(procedure, standardRequest.params), | ||
| }, standardRequest), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Path params now depend entirely on the custom toNestStandardLazyRequest populating .params — no fallback to req.params.
Previously decodeInput read req.params directly regardless of any custom conversion hook. Now it only reads standardRequest.params, which is optional and not set by the default value unless the default converter runs. Anyone with a pre-existing custom toStandardLazyRequest implementation who mechanically renames it to toNestStandardLazyRequest (required to compile) will silently lose OpenAPI dynamic-path-param decoding unless they also remember to populate .params — this only surfaces later as an input-validation failure, not a compile error.
Consider falling back to the raw request params to preserve backward compatibility for existing custom implementations:
🛡️ Suggested fallback
decodeInput: () => this.codec.decodeInput({
procedure,
- params: toORPCOpenAPIParams(procedure, standardRequest.params),
+ params: toORPCOpenAPIParams(procedure, standardRequest.params ?? (req.params as NestStandardLazyRequest['params'])),
}, standardRequest),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const standardRequest = this.toNestStandardLazyRequest(req, res) | |
| const handler = new StandardHandler({ | |
| resolveProcedure: () => Promise.resolve({ | |
| path: getPathMeta(procedure) ?? [], | |
| procedure, | |
| decodeInput: () => this.codec.decodeInput({ | |
| procedure, | |
| params: toORPCOpenAPIParams(procedure, req.params as NestParams), | |
| params: toORPCOpenAPIParams(procedure, standardRequest.params), | |
| }, standardRequest), | |
| const standardRequest = this.toNestStandardLazyRequest(req, res) | |
| const handler = new StandardHandler({ | |
| resolveProcedure: () => Promise.resolve({ | |
| path: getPathMeta(procedure) ?? [], | |
| procedure, | |
| decodeInput: () => this.codec.decodeInput({ | |
| procedure, | |
| params: toORPCOpenAPIParams(procedure, standardRequest.params ?? (req.params as NestStandardLazyRequest['params'])), | |
| }, standardRequest), |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/nest/src/implement.ts` around lines 140 - 149, The path-parameter
decoding in implement.ts now depends only on toNestStandardLazyRequest
populating standardRequest.params, which breaks existing custom converters that
only renamed to the new hook. Update the decodeInput flow in implement() so it
preserves backward compatibility by falling back to the raw request params when
standardRequest.params is absent, using the existing
toNestStandardLazyRequest/standardRequest path as the primary source and
req.params as the fallback.

Summary by CodeRabbit
toNestStandardLazyRequesthook.toNestStandardLazyRequestand to include additional params in the converted request.