Skip to content

feat(nest): rename toStandardLazyRequest to toNestStandardLazyRequest with additional params#1611

Merged
dinwwwh merged 2 commits into
middleapi:mainfrom
dinwwwh:feat/nest/rename-to-toNestStandardLazyRequest-with-additional-params
Jul 1, 2026
Merged

feat(nest): rename toStandardLazyRequest to toNestStandardLazyRequest with additional params#1611
dinwwwh merged 2 commits into
middleapi:mainfrom
dinwwwh:feat/nest/rename-to-toNestStandardLazyRequest-with-additional-params

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Jul 1, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • NestJS request conversion now supports passing route parameters through to handlers via the updated toNestStandardLazyRequest hook.
  • Bug Fixes
    • Fixed request parsing so route parameters are preserved and used during input decoding.
  • Documentation
    • Updated the NestJS integration example to use toNestStandardLazyRequest and to include additional params in the converted request.
  • Tests
    • Updated NestJS integration tests to match the new request-shape and option behavior.

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 1, 2026
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
orpc Ready Ready Preview, Comment Jul 1, 2026 1:03pm

@dosubot dosubot Bot added enhancement New feature or request javascript Pull requests that update javascript code labels Jul 1, 2026

@gemini-code-assist gemini-code-assist 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.

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.

Comment thread apps/content/docs/integrations/nest.md
Comment thread packages/nest/src/module.ts
@pkg-pr-new

pkg-pr-new Bot commented Jul 1, 2026

Copy link
Copy Markdown
More templates

@orpc/arktype

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

@orpc/bun

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

@orpc/client

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

@orpc/contract

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

@orpc/experimental-effect

npm i https://pkg.pr.new/@orpc/experimental-effect@1611

@orpc/evlog

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

@orpc/interop

npm i https://pkg.pr.new/@orpc/interop@1611

@orpc/json-schema

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

@orpc/nest

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

@orpc/next

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

@orpc/openapi

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

@orpc/opentelemetry

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

@orpc/pino

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

@orpc/publisher

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

@orpc/ratelimit

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

@orpc/server

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

@orpc/shared

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

@orpc/tanstack-query

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

@orpc/valibot

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

@orpc/zod

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

commit: db705c7

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bd725059-b4e2-4d0a-a2b8-a35ecbe124c1

📥 Commits

Reviewing files that changed from the base of the PR and between c031e42 and db705c7.

📒 Files selected for processing (1)
  • packages/nest/src/module.ts

📝 Walkthrough

Walkthrough

Renames the Nest request conversion hook to toNestStandardLazyRequest, adds NestStandardLazyRequest.params, updates param decoding to use it, and aligns the Nest test and docs with the new request shape.

Changes

Nest params support

Layer / File(s) Summary
NestStandardLazyRequest type and config contract
packages/nest/src/module.ts
Adds NestStandardLazyRequest extending StandardLazyRequest with an optional params field; renames ORPCModuleConfig's conversion hook to toNestStandardLazyRequest.
Request interceptor and param decoding update
packages/nest/src/implement.ts
Updates imports and interceptor field to toNestStandardLazyRequest; default conversion now assigns standardRequest.params; decodeInput derives OpenAPI params via toORPCOpenAPIParams(procedure, standardRequest.params); updates toORPCOpenAPIParams param type.
Tests for custom request parser with params
packages/nest/src/implement.test.ts
Updates imports to NestStandardLazyRequest, changes contract route to /parser/{param} with inputStructure: 'detailed', renames mocked factory to toNestStandardLazyRequest returning params, and updates response/mock call assertions.
Documentation update for toNestStandardLazyRequest
apps/content/docs/integrations/nest.md
Renames the documented option and replaces the example with a concrete snippet assigning standardRequest.params.

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
Loading

Possibly related PRs

  • middleapi/orpc#710: Prior Nest module configuration work on ORPCModuleConfig that this PR extends by renaming the conversion hook and updating related request handling.
  • middleapi/orpc#1299: Similar adapter request-conversion changes in packages/nest/src/implement.ts, including route param handling for decodeInput.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: renaming the Nest request hook and adding support for additional params.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ℹ️ Minor suggestions only. No functional issues — the rename, new NestStandardLazyRequest type, and documented example cover the stated goal. vitest, eslint, and tsc -b for 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.toStandardLazyRequest to toNestStandardLazyRequest and update the default converter accordingly.
  • Introduce NestStandardLazyRequest extending StandardLazyRequest with an optional params field and export it from @orpc/nest.
  • Assign req.params into standardRequest.params in the default converter and use standardRequest.params when decoding OpenAPI path parameters.
  • Update the NestJS integration docs and the custom-parser test case.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/nest/src/module.ts Outdated
Comment thread apps/content/docs/integrations/nest.md
@dinwwwh dinwwwh merged commit ccf6c46 into middleapi:main Jul 1, 2026
9 of 10 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between b435248 and c031e42.

📒 Files selected for processing (4)
  • apps/content/docs/integrations/nest.md
  • packages/nest/src/implement.test.ts
  • packages/nest/src/implement.ts
  • packages/nest/src/module.ts

Comment on lines +140 to 149
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),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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.

Suggested change
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.

Comment thread packages/nest/src/module.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request javascript Pull requests that update javascript code size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant