-
Notifications
You must be signed in to change notification settings - Fork 655
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
Don't use pointers for required properties #921
Comments
I am aware that this topic has been discussed before and the result was that the change would not be made because it would be a breaking change. That conversation was a year ago and this SDK has had a major breaking changes since that time so I think it's worth opening the conversation again. Two other facts also make this less of a problem: 1) This repository carries a warning that it's in beta and changes are likely, 2) go modules mean that customer code is pinned to a version of this SDK and only a developer manually updating their dependency will expose them to the change. This would be a relatively simple, one time breaking change to fix a consistent customer complaint I've seen repeated in a number of media :) |
Thanks for reaching out @stilvoid with this feature request. One of the biggest reasons the v1 and v2 SDK's have not been able to adopted using value types for required members, is not so much that it would create breaking change now in the v2 SDK, but the likely breaking changes later after the SDK has released. One of the aspects governing AWS API models is that while With that said the v2 SDK does have new modeling metadata allowing it to render some members a value types instead of pointers types for everything. In the API model this is represented by For example the Amazon EC2 API aws-sdk-go-v2/service/ec2/api_op_ModifyTrafficMirrorSession.go Lines 30 to 72 in 979cf22
In addition to list, maps, booleans, and number types, the SDK will also generate all enum parameters as value types instead of strings. aws-sdk-go-v2/service/ec2/types/types.go Lines 9261 to 9262 in 979cf22
The list, map, bool, and number change hasn't been included in a tagged release yet, but will be when the the next release is published. |
Thanks for the response @jasdel :) The recent change certainly looks like it goes some way towards improving things 👍 I still think we have an opportunity to improve things even further though. Given that each service is now an independently-versioned go module, we have a mechanism to flag and protect users from breaking changes such as an API dropping the "required" flag for a parameter. The Go SDK doesn't have to follow the same versioning scheme as the API. As a developer of some application using AWS APIs, I think I'd prefer to be notified (by way of my code breaking when I update my dependencies) that a parameter is no longer required rather than the value simply disappearing into a black hole. Appreciate you will disagree, so just saying thanks for the considered response :) |
|
Is your feature request related to a problem? Please describe.
It's frustrating (and not very Gopher-like) to have to do so much conversion to and from pointer types
Describe the solution you'd like
For required properties of Input and Output structs, do not use pointers.
For example:
This more adequately expresses the optional/required distinction through the API which will mean the compiler will catch mistakes before a developer runs into them.
Describe alternatives you've considered
None. Any other solution would be more complex and this change would add a significant simplification imo
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: