Skip to content
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

Move Message, Header, HeaderValue, and StrBytes from aws-smithy-eventstream to aws-smithy-types #3139

Merged
merged 17 commits into from
Nov 6, 2023

Conversation

ysaito1001
Copy link
Contributor

@ysaito1001 ysaito1001 commented Nov 2, 2023

Motivation and Context

Fixes the following statement in #3114

A notable breaking change is the error type of the new recv method. Previously, it was SdkError<E, RawMessage>> but it is now a BoxError. This means that upon an event receive error, customers can only show what the error is, but not match on it and take some actions.

so that the recv method on a new-type wrapper aws_smithy_http::event_stream::Receiver can expose SdkError<E, RawMessage>> in public API. It is the responsibility of the above PR to move RawMessage from aws-smithy-http to aws-smithy-types but doing so first requires Message to be moved to aws-smithy-types, hence this PR.

Description

Moving Message to aws-smithy-types also requires moving the types it depends upon, namely Header, HederValue, and StrBytes. However, their serialization/deserialization methods (read_from and write_to) remain in aws-smithy-eventstream and they are converted to free functions, with the aim of moving things as minimally as possible.

aws-smithy-eventstream has fuzz testing. It previously implemented the Arbitrary trait for moved types, but since they are now in aws-smithy-types, we need to have newtypes for them to enable the trait due to the orphan rules. A newly added module aws-smithy-eventstream::arbitrary is exactly for that purpose.

Testing

Relied on the existing tests.

Checklist

  • I have updated CHANGELOG.next.toml if I made changes to the smithy-rs codegen or runtime crates

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

github-actions bot commented Nov 2, 2023

Copy link

github-actions bot commented Nov 2, 2023

@ysaito1001 ysaito1001 marked this pull request as ready for review November 2, 2023 15:49
@ysaito1001 ysaito1001 requested review from a team as code owners November 2, 2023 15:49
Copy link

github-actions bot commented Nov 2, 2023

A new generated diff is ready to view.

A new doc preview is ready to view.

pub(crate) const TYPE_STRING: u8 = 7;
pub(crate) const TYPE_TIMESTAMP: u8 = 8;
pub(crate) const TYPE_UUID: u8 = 9;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a general question, so we do not allow a float / double as a type in HeaderValue? I guess, they can always be passed as a String.

Copy link

github-actions bot commented Nov 3, 2023

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link

github-actions bot commented Nov 3, 2023

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link
Collaborator

@jdisanti jdisanti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@ysaito1001 ysaito1001 added this pull request to the merge queue Nov 6, 2023
Merged via the queue into main with commit c296e8e Nov 6, 2023
41 checks passed
@ysaito1001 ysaito1001 deleted the ysaito/move-message-to-smithy-types branch November 6, 2023 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This will require a breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants