'Nullability Update' upgrade guidance and info. #2929
Velfi
announced in
Change Log
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This change has not yet been released. Track its status here.
The AWS Rust SDK and smithy-rs code generator have both been updated to respect smithy's @required trait. This means that many struct fields will no longer be wrapped in an unnecessary
Option
, with some caveats.Codegen now respects nullability
Option
.@required
to optional using a@default
trait.Option
. However, different "nullability check modes" may be specified during codegen to influence this. To do so, set thenullabilityCheckMode
option in yoursmithy.json
to either of the following values:CLIENT
(The default for generic smithy clients.)CLIENT_CAREFUL
(The default for generating AWS SDKs.)e.g.
How to upgrade your usage of AWS SDKs if it was broken by this update.
Before this change, it was common for users to unwrap required struct fields. After this change, compiling projects with code like this will result in errors similar to these:
For builders that used to be fallible but aren't anymore:
For struct fields that used to be
Option
-wrapped by aren't anymore:To fix these errors, simply remove the calls to
.unwrap()
:Beta Was this translation helpful? Give feedback.
All reactions