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

Alias type name hides interface type name in generated input/output types #371

Open
DanielBauman88 opened this issue Jul 5, 2022 · 1 comment
Labels
guidance Question that needs advice or information.

Comments

@DanielBauman88
Copy link

Alias type name hides interface function name.

This led me down an interesting exploration of go and how a field can hide a function given by an anonymous struct field.

It makes the code confusing to someone reading it. What is the benefit of naming these the same thing? If there's no practical benefit - why not have the interface method and the type alias have different names? The method isn't exported anyway and won't clutter the autocomplete of customers.

@skmcgrail
Copy link
Member

This concept was introduced when we added support for Smithy document shapes in the code generator. The background for this decision was we wanted to forgo making a one-way door decision on whether the auto-generated types within a service's client package should be usable as values for a document shape member. If we were to allow these shapes then we would have to make a standardized decision on the serialization behavior, and ensure that is consistent with other SDK implementations. We may lift this in the future, but for the moment this sentinel value allows us to detect if such an auto-generated type is being used as a document value, and return an appropriate error in those instances.

The downside to this is that it does require users to specify the field names when using structure initialization.

@skmcgrail skmcgrail added the guidance Question that needs advice or information. label Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

2 participants