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

Use the default(..) trait to source default information #2982

Closed
wants to merge 4 commits into from

Conversation

rcoh
Copy link
Collaborator

@rcoh rcoh commented Sep 12, 2023

Motivation and Context

Because of Smithy IDL v1 semantics, we were incorrectly providing generalized default values. This isn't correct in Smithy IDLv2 where the default trait controls default behavior.

Description

  • Source default information from the default trait instead of automatically providing it for all primitive shapes.
  • Add "error_correcting_builder" when required which effectively adds back the old lax-defaults but only for deserialization

Testing

  • unit tests

Checklist

  • I have updated CHANGELOG.next.toml if I made changes to the smithy-rs codegen or runtime crates
  • I have updated CHANGELOG.next.toml if I made changes to the AWS SDK, generated SDK code, or SDK 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.

@rcoh rcoh requested review from a team as code owners September 12, 2023 19:38
@rcoh rcoh force-pushed the trait-driven-defaults branch from 059aa70 to 16e8771 Compare September 12, 2023 19:56
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link
Contributor

@ysaito1001 ysaito1001 left a comment

Choose a reason for hiding this comment

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

The change looks good.

Because of Smithy IDL v1 semantics, we were incorrectly providing generalized default values

Is there any test that is broken because of the reason above and is now fixed with this PR?

@rcoh rcoh force-pushed the trait-driven-defaults branch from 16e8771 to 841afc2 Compare September 13, 2023 13:53
@rcoh
Copy link
Collaborator Author

rcoh commented Sep 13, 2023

The change looks good.

Because of Smithy IDL v1 semantics, we were incorrectly providing generalized default values

Is there any test that is broken because of the reason above and is now fixed with this PR?

No, I wouldn't expect there to be—this change is only load-bearing in combination with #1767

@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@rcoh rcoh force-pushed the trait-driven-defaults branch from 841afc2 to 1f08e01 Compare September 13, 2023 19:26
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@rcoh rcoh closed this Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants