implement schema-serde event streams#641
Merged
lucix-aws merged 4 commits intofeat-serde2-eventstreamfrom Apr 3, 2026
Merged
Conversation
Contributor
Author
|
relates #458 |
wty-Bryant
reviewed
Mar 20, 2026
3 tasks
Madrigal
reviewed
Mar 23, 2026
| Symbol opEventStreamConstructor, | ||
| Symbol opEventStreamSymbol) { | ||
|
|
||
| // For v2 (early-return) event streams, we must: |
| // DeserializeInitialResponse reads the first event stream message and | ||
| // deserializes it as the operation output. | ||
| func (c *Codec) DeserializeInitialResponse(schema *smithy.Schema, r io.Reader, out smithy.Deserializable) error { | ||
| c.payloadBuf = c.payloadBuf[0:0] |
| } | ||
|
|
||
| func (d *ShapeDeserializer) ReadString(s *smithy.Schema, v *string) error { | ||
| if d.inBindings { |
Contributor
There was a problem hiding this comment.
mostly a question for me, but why inBindings mean look into event stream stuff?
| if d.inBindings && isEventHeader(s) { | ||
| return readEventHeaderInt(d, s, v) | ||
| } | ||
| return d.inner.ReadInt8(s, v) |
Contributor
There was a problem hiding this comment.
should we do any bounds check?
Contributor
Author
There was a problem hiding this comment.
So instead of doing bounds check I made it actually type assert for Int8Value, Int16Value, etc. to match what the old code did. so they should be functionally equivalent now
.../smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/EventStreamGenerator.java
Show resolved
Hide resolved
...egen/src/main/java/software/amazon/smithy/go/codegen/serde2/Serde2EventStreamMiddleware.java
Outdated
Show resolved
Hide resolved
Madrigal
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
implements schema-serde event stream support for aws-framed protocols (i.e. all of them)
https://smithy.io/2.0/aws/amazon-eventstream.html#amazon-eventstream
This is fundamentally the exact same thing that we had before, with all of the pieces of event stream wireup split out to allow for schema-serde. If you open up an existing generated event stream body, e.g. https://github.com/aws/aws-sdk-go-v2/blob/main/service/transcribestreaming/eventstream.go, you will see how things sort of map out in the new runtime. I made a point of preserving the structure of the old code as much as possible.
at a glance:
example of generated type adapter:
I did manual e2e tests w/ transcribestreaming,bedrockruntime, and cloudwatchlogs.