-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(trpc): make input arg's optionality consistent with Prisma #1730
Conversation
WalkthroughWalkthroughThe changes introduce a new boolean variable Changes
Assessment against linked issues
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
packages/plugins/trpc/src/helpers.ts (1)
51-53
: Consider defining the operations list as a constant for maintainabilityThe array of operation names used to determine
argsOptional
is defined inline. To improve maintainability and readability, consider defining this array as a constant at the top of the file or in a shared configuration. This makes it easier to manage and update the list of operations in the future.Apply this diff to define the operations list as a constant:
+const optionalArgsOperations = ['findMany', 'findFirst', 'findFirstOrThrow', 'createMany', 'deleteMany', 'count']; ... -const argsOptional = ['findMany', 'findFirst', 'findFirstOrThrow', 'createMany', 'deleteMany', 'count'].includes( - operation -); +const argsOptional = optionalArgsOperations.includes(operation);
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (4)
packages/plugins/trpc/tests/projects/t3-trpc-v10/src/server/api/routers/generated/routers/Post.router.ts
is excluded by!**/generated/**
,!**/generated/**
packages/plugins/trpc/tests/projects/t3-trpc-v10/src/server/api/routers/generated/routers/User.router.ts
is excluded by!**/generated/**
,!**/generated/**
packages/plugins/trpc/tests/projects/t3-trpc-v11/src/server/api/routers/generated/routers/Post.router.ts
is excluded by!**/generated/**
,!**/generated/**
packages/plugins/trpc/tests/projects/t3-trpc-v11/src/server/api/routers/generated/routers/User.router.ts
is excluded by!**/generated/**
,!**/generated/**
Files selected for processing (1)
- packages/plugins/trpc/src/helpers.ts (8 hunks)
Additional comments not posted (2)
packages/plugins/trpc/src/helpers.ts (2)
Line range hint
207-243
: Verify that optionality of 'input' parameter is correctly applied across all operationsThe use of
input${inputOptional}
adjusts the optionality of theinput
parameter based on the operation type. Please ensure that all operations that should accept optional inputs are included inargsOptional
, and that this change doesn't impact operations where the input should remain mandatory.
305-305
: Ensure consistent application of '.optional()' to input schemasAdding
.optional()
to input schemas for operations like'findFirst'
,'findMany'
,'createMany'
,'deleteMany'
, and'count'
makes their inputs optional. Verify that this aligns with Prisma's specifications and consider if any other operations should also have their input schemas marked as optional for consistency.Also applies to: 308-308, 317-317, 326-326, 344-344
Fixes #1707