-
Notifications
You must be signed in to change notification settings - Fork 249
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
[request] Make way fewer things Option<T> types #536
Comments
Thanks for filing! This is definitely something we want to improve, and we're hoping to make many of these optional fields required prior to GA. See also the discussion in #163 |
Awesome, good to hear! |
Smithy IDL 2.0 now makes it possible to reduce the number of optional types, and our code generator has been updated to support it. I think we just need to modify the code generator to query Smithy's |
This will go out with the next big release (it will be announced in the release notes when it is, so if there are other releases before it, it is not in those). |
|
Describe the feature
In the model types for each API (e.g. ec2), nearly every field is
Option<T>
. This means that developers have to make a bunch of boilerplate error handling by callingunwrap_or_default
,ok_or
, etc.I expect that many fields are actually guaranteed to exist when making calls. For example, when calling
ec2_client.describe_instances
, everyInstance
should always have aninstance_id
. Otherwise, how would ever do anything with it?This feature request is to comb through all the APIs and only use
Option<T>
on values that aren't guaranteed to exist.Use Case
This significantly reduces the amount of boilerplate error handling needed around errors that should never occur.
Proposed Solution
Only mark truly optional fields and types as
Option<T>
and update all thebuilder()
calls to accept required fields as parameters.Other Information
This feature will definitely be a breaking change.
Acknowledgements
A note for the community
Community Note
The text was updated successfully, but these errors were encountered: