-
Notifications
You must be signed in to change notification settings - Fork 218
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
How are union
shapes bound with httpPayload
serialized in JSON-based protocols?
#1462
Comments
It's serialized exactly like a structure. It's supported, I just don't think it's been used much in practice yet. We also should add a protocol test. With an HTTP payload like in your example, it's serialized as the full payload:
No, you'd serialize the union value inside the outer structure. If the
|
Ah, my bad. This is how we're doing it. How do we serialize the union when the user has not set it (it's not {
"union": null
} So it seems like binding the union shape with null And for protocols that don't serialize It's doable, but implementation-wise tricky, since the deserializer has to account for it expecting a JSON object or a value (or nothing) at the top-level. Just to confirm, is this behavior what we want? |
Unions can’t be assigned a default value, |
I'm confused, is this implying that I thought IDL v2 only made that provision for
|
Oh whoops. You’re right. Hm, I don’t know if we need to support an explicit null or can just rely on there being no payload at all. |
Just to document the decision that was made, the added tests show that no payload is sent if the union has no value. |
The
httpPayload
trait:Of note is that no AWS protocol supports
list
ormap
, but presumablyunion
is supported in e.g.restJson1
. How is it serialized?Consider:
Surely the
good
/bad
tag needs to be serialized in the payload for a deserializer to know what exact variant it's deserializing.If you don't bind with
httpPayload
, you'd serialize:The text was updated successfully, but these errors were encountered: