fix(signalr): fail to parse MessagePack-CSharp-Union | None type when protocol is msgpack

This commit is contained in:
MingxuanGame
2025-08-08 06:25:31 +00:00
parent 2bb1e4bad2
commit fb0bba1a6e

View File

@@ -242,7 +242,9 @@ class MsgpackProtocol:
# except `X (Other Type) | None`
if NoneType in args and v is None:
return None
if not all(issubclass(arg, SignalRUnionMessage) for arg in args):
if not all(
issubclass(arg, SignalRUnionMessage) or arg is NoneType for arg in args
):
raise ValueError(
f"Cannot validate {v} to {typ}, "
"only SignalRUnionMessage subclasses are supported"