fix(orm): preserve array mutation shape for optional typed-JSON fields#2557
Conversation
makeNullableTypedJsonMutationSchema was rebuilding the schema from type and attributes via makeScalarSchema, discarding any prior array/list mutation shape (set, push, etc.) built by the caller. Pass the already-built fieldSchema so the full shape is preserved. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe function Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
Claude finished @ymc9's task —— View job PR Code ReviewReview Tasks
SummaryThis PR fixes a bug in the Zod schema factory where Code Quality & Implementation ✅Excellent implementation with clear improvements:
Potential Issues ✅No significant issues found:
Performance Considerations ✅Performance neutral or slightly improved:
Security Considerations ✅No security concerns:
Test Coverage Assessment
|
Summary
makeNullableTypedJsonMutationSchemawas callingmakeScalarSchema(type, attributes)internally, which discarded the already-builtfieldSchemapassed by callers — including any array/list mutation shape ({ set }on create,{ set, push }on update)fieldSchema: z.ZodTypeAnyparameter and use it directly insafeParseinstead of reconstructing from scratchfieldSchemaTest plan
{ set: [...] }on create{ set, push }operators on updateDbNull/JsonNullsentinels still pass validation for optional typed-JSON fieldspnpm test🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes