aws-sdk-rust icon indicating copy to clipboard operation
aws-sdk-rust copied to clipboard

[request]: sdk model structs should not have `Optional` type if the field is marked as `required` in smithy.

Open asanthan-amazon opened this issue 4 years ago • 3 comments
trafficstars

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue, please leave a comment

Tell us about your request Currently, all the fields in generated types are marked as Optional. But, the sdk should generate types where fields should not be marked as Optional if it is marked as @required in Smithy.

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard? The generated sdk model types should not have Optional type if the field is marked as required in smithy.

Are you currently working around this issue? Because, it is marked as Optional, there is no compile-time validation to say if the entire type is fully constructed or not. As a work around, we create another wrapper type which does not use Optional for required fields.

Additional context Anything else we should know?

Attachments If you think you might have additional information that you'd like to include via an attachment, please do - we'll take a look. (Remember to remove any personally-identifiable information.)

asanthan-amazon avatar Oct 27 '21 19:10 asanthan-amazon

Thanks for submitting this issue!

The reason for this is that in smithy it's not considered a breaking change to add or remove the required trait. However, we do recognize that the user experience could be improved in this area and we're open to solutions.

Velfi avatar Oct 27 '21 19:10 Velfi

see also #163

rcoh avatar Nov 01 '21 16:11 rcoh

I think if the service team removes required trait, that is backward incompatible change from my perspective. In which case, a new version of SDK needs to be generated that customer can use.

In that way, customer will come to know explicitly that an optional field now becomes mandatory or vice-versa.

asanthan-amazon avatar Nov 01 '21 16:11 asanthan-amazon

Tracking this in #536.

jdisanti avatar Sep 30 '22 21:09 jdisanti

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Sep 30 '22 21:09 github-actions[bot]