- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 12
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(client, server): prevent toJSON problem #279
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis update enhances the serialization logic in both the RPC and OpenAPI adapters. New test cases cover scenarios where objects have a Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Serializer
Client->>Serializer: Call serialize(inputObject)
Serializer->>Serializer: Iterate over input keys
alt Key is "toJSON" and is a function
Serializer->>Serializer: Skip property
else
Serializer->>Serializer: Process property normally
end
Serializer->>Serializer: Convert result to JSON string and parse (RPC flow)
Serializer->>Client: Return serialized output
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🧰 Additional context used🧬 Code Definitions (1)packages/client/src/adapters/standard/rpc-json-serializer.ts (2)
🔇 Additional comments (5)
✨ Finishing Touches
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. 🪧 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 (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
More templates
@orpc/arktype
@orpc/client
@orpc/openapi
@orpc/openapi-client
@orpc/contract
@orpc/react-query
@orpc/server
@orpc/shared
@orpc/solid-query
@orpc/standard-server
@orpc/standard-server-fetch
@orpc/standard-server-node
@orpc/svelte-query
@orpc/valibot
@orpc/vue-colada
@orpc/vue-query
@orpc/zod
commit: |
Skip custom toJSON methods to avoid JSON.stringify invoking them,
which could cause meta and serialized data mismatches during deserialization.
Instead, rely on custom serializers.
Summary by CodeRabbit
Bug Fixes
Tests