-
Notifications
You must be signed in to change notification settings - Fork 131
fix(rivetkit): fix zod not validating body if content-type header not provided #3456
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
base: 11-11-fix_rivetkit_fix_onerror_handler_not_working
Are you sure you want to change the base?
Conversation
|
Deployment failed with the following error: Learn More: https://vercel.com/docs/limits#rate-limits |
Code ReviewSummaryThis PR introduces a Positive Aspects ✅
Regarding the PR TitleThe PR title mentions "fix zod not validating body if content-type header not provided", but I do not see evidence in the diff that this change directly addresses that issue. The refactoring extracts inline code into a helper function but does not appear to change validation behavior. Questions:
Minor Suggestions 💡
Files Changed
Overall AssessmentThis is a solid refactoring that improves code quality. However, clarification is needed on whether this actually fixes a validation bug or is purely a refactoring. If it is a bug fix, additional context and tests would strengthen the PR. Status: Approve pending clarification on the bug fix claim in the title. |
6667afc to
6cb921c
Compare
89cf636 to
5fa1ff1
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
Code ReviewSummaryThis PR fixes a bug where Zod validation wasn't working when the Positive Feedback ✅Code Quality
Bug Fix
Code Reduction
Suggestions for Improvement 💡1. Test Coverage
Example test location: 2. Documentation 3. Completeness Check 4. Commit Message Security Considerations 🔒No security concerns identified. The change actually improves security by ensuring validation runs consistently. Performance Considerations ⚡No performance impact - this is purely a refactoring that maintains the same OpenAPI spec structure. Final VerdictApprove with minor suggestions ✅ This is a solid bug fix with good code quality. The only missing piece is test coverage to prevent regression. The refactoring improves maintainability and follows established patterns in the codebase. Action Items:
Great work on identifying and fixing this validation issue! |
Code ReviewSummaryThis PR extracts the request body definition into a reusable helper function buildOpenApiRequestBody and adds the required: true property, which should fix the issue where Zod validation wasn't occurring when the Content-Type header wasn't provided. Positive Aspects
Potential Issues & Questions
Recommendations
Code Quality: 8/10The refactoring itself is clean and well-structured. The main concerns are around testing and documentation rather than the implementation itself. Verdict: Approve pending tests and documentation improvements. The code change is correct, but needs test coverage to prevent regressions. |
6cb921c to
b49dcfa
Compare
5fa1ff1 to
7a00c89
Compare
Code Review SummaryThis PR refactors request body definitions in OpenAPI routes by extracting a reusable ✅ Strengths
🤔 Questions & Suggestions1. Title vs. Implementation MismatchThe PR title mentions "fix zod not validating body if content-type header not provided", but the diff shows only a refactoring. Could you clarify:
2. Test CoverageConsider adding tests for:
Example test location: 3. Type Safety EnhancementConsider adding a type constraint for better type safety: function buildOpenApiRequestBody<T extends z.ZodType>(schema: T) {
return {
required: true,
content: {
"application/json": {
schema,
},
},
};
}4. DocumentationIf this fixes a validation bug, add a comment to prevent future regressions: // Ensures Zod validation is triggered even when Content-Type header is missing
// by explicitly marking the request body as required in the OpenAPI spec
function buildOpenApiRequestBody<T>(schema: T) {📝 Missing ContextThe PR body is empty. Please add:
🔍 Overall AssessmentCode Quality: 9/10 The refactoring is solid and follows established patterns in the codebase. However, there is a disconnect between the PR title (suggesting a bug fix) and the implementation (showing a refactoring). If this is truly a bug fix, it needs:
Recommendation: ✅ Approve with suggestions The code change itself is correct and improves the codebase. The main gaps are around documentation and testing. If this is purely a refactoring (not a bug fix), consider updating the PR title to reflect that. Great work on maintaining consistency in the codebase! Let me know if you would like help adding tests for this change. 🚀 |
Code ReviewThis PR refactors request body definitions by extracting a reusable buildOpenApiRequestBody helper. The change improves consistency and fixes a Zod validation issue when Content-Type header is missing. POSITIVE ASPECTS:
SUGGESTIONS:
SECURITY: No concerns. Improves security by enforcing validation. PERFORMANCE: No impact. Same runtime behavior. VERDICT: Approve with minor suggestions The core fix is solid. Main gap is test coverage to prevent regression. Great work identifying this validation bug! Action items:
|
b49dcfa to
513dcb4
Compare
7a00c89 to
51383ee
Compare
Code ReviewSummaryThis PR introduces a helper function Positive Aspects✅ Code Quality: The refactoring follows DRY principles by extracting repeated request body configuration into a reusable helper function, similar to the existing ✅ Consistency: The change makes request body definitions consistent across both PUT and POST endpoints for actor creation. ✅ Maintainability: Future changes to request body structure can now be made in a single location. Issues & Concerns1. Missing
|

No description provided.