-
Notifications
You must be signed in to change notification settings - Fork 195
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 errors for unions with unit target membershape #3547
Conversation
A new generated diff is ready to view.
A new doc preview is ready to view. |
d6c6cb8
to
70ab968
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
70ab968
to
24ef5a7
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
} | ||
""".asSmithyModel() | ||
|
||
serverIntegrationTest(model) { _, rustCrate -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why we need the tests below if all we want to check is that the model compiles correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that we can extend the same test to RpcV2Cbor (and possibly other protocols). Since event streams are not covered by the protocol tests, and none of the other tests were failing, I assume we do not have a test that actually checks whether data is being correctly serialized/deserialized. However, having said that, I think it is better to add comprehensive tests that use a client to serialize and then use the server to deserialize it. Currently, these tests directly use the inner data types/methods rather than invoking the server. Will remove these tests for now and we can add one in v2Cbor.
Closes #2546. |
2be83a3
to
03059e4
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed primarily those in codegen-core
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
Motivation and Context
Unions that have a unit target member shape do not have an associated data in the generated Rust enum.
Closes Issue: 2546
Description
On the server side, when the union has constrained members, the code generated for the conversion from the
Unconstrained
type to theConstrained
type incorrectly assumed that each Rust enum would have associated data.The marshaling code for event streams with unit target types incorrectly assumed that the variant would have associated data.
On the client side, the
event_stream_serde
code incorrectly assumes that a union member, which has the@streaming
trait applied to it, takes amodel::Unit
type.Testing
A unit test has been added that tests the following model: