Fixing bug with enums as eventHeaders#4337
Conversation
|
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. |
| BAR | ||
| } | ||
|
|
||
| intEnum FaceCard { |
There was a problem hiding this comment.
No, but I still think this should stay in the test so that when we do support them we get an obvious test failure if they don't work as @eventHeaders instead of a false positive.
| is IntegerShape -> rustTemplate("#{expect_fns}::expect_int32(header)?", *codegenScope) | ||
| is LongShape -> rustTemplate("#{expect_fns}::expect_int64(header)?", *codegenScope) | ||
| is BlobShape -> rustTemplate("#{expect_fns}::expect_byte_array(header)?", *codegenScope) | ||
| is EnumShape -> rustTemplate("#{expect_fns}::expect_string(header)?.as_str().into()", *codegenScope) |
There was a problem hiding this comment.
I don't think any codegen actually supports intEnum (see #1700) so it isn't handled here. I did add it to the test model though so when we do support it we will get an obvious error in these tests if it doesn't work as an @eventHeader.
|
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
Fixing a bug that was discovered with smithy
enumandintEnumshapes that are marked as@eventHeader. This came up in an internal investigation around a failed preview build.Description
Added handling of
EnumShapeinEventStreamUnmarshallerGeneratorandEventStreamMarshallerGenerator.Testing
Added new
enumandintEnumshapes to the evenstream test model. They are only included in client tests since the server throws a validation error on enums in event streams (see smithy-lang/smithy#1388 for more info).Also tested against the model from the failed preview build and a
cargo test --all-featureswas successful.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.