You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For reasons outlined here, RawValue can't be
used with untagged enums at the moment.
This means we can't use an SingleOrBatch untagged enum to handle incoming requests that can be one of:
single JSONRPC request, i.e. {"jsonrpc":"2.0","method":"bar","id":1}
a batch of requests, i.e. [{"jsonrpc":"2.0","method":"baz","id":1}, {"jsonrpc":"2.0","method":"baz","id":2}]
a single notification, i.e. {"jsonrpc":"2.0","method":"bezz"}
a batch of notifications, i.e. [{"jsonrpc":"2.0","method":"bezz"}, {"jsonrpc":"2.0","method":"bozz"}, {"jsonrpc":"2.0","method":"bizz"}]
(We do not support notifications, but if we ever were to do that to be fully compliant with the spec, this problem would make things worse)
Instead we have to try each case individually: first the single request case, then the batch case and then one time more to check for the error. For the worst case – unparseable input – we make three calls to [serde_json::from_slice] which is pretty annoying.
For reasons outlined here,
RawValue
can't beused with untagged enums at the moment.
This means we can't use an
SingleOrBatch
untagged enum to handle incoming requests that can be one of:{"jsonrpc":"2.0","method":"bar","id":1}
[{"jsonrpc":"2.0","method":"baz","id":1}, {"jsonrpc":"2.0","method":"baz","id":2}]
{"jsonrpc":"2.0","method":"bezz"}
[{"jsonrpc":"2.0","method":"bezz"}, {"jsonrpc":"2.0","method":"bozz"}, {"jsonrpc":"2.0","method":"bizz"}]
(We do not support notifications, but if we ever were to do that to be fully compliant with the spec, this problem would make things worse)
Instead we have to try each case individually: first the single request case, then the batch case and then one time more to check for the error. For the worst case – unparseable input – we make three calls to [
serde_json::from_slice
] which is pretty annoying.There is a PoC fix for this in serde-rs/serde#1354
Suggestion: revisit this when/if serde-rs/serde#1354 lands.
The text was updated successfully, but these errors were encountered: