-
Notifications
You must be signed in to change notification settings - Fork 54
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
Update unions #146
Update unions #146
Conversation
13423d5
to
21d5aeb
Compare
2c4c8d3
to
0e9de0c
Compare
...n/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/ShapeValueGenerator.java
Show resolved
Hide resolved
0e9de0c
to
83a19b1
Compare
if (target instanceof SimpleShape) { | ||
writer.write("Value $T", memberSymbol); | ||
} else { | ||
writer.write("Value $P", memberSymbol); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not specific to this PR, but at some point we should take a look at how slice/map types are generated from $T
, and $P
. If a member is or is not a pointer of a slice/map should not be driven by $T
, or $P
, the member being a pointer is driven by the modeled list/map shape, and its member.
This mean that $T
should generate the correct Go type for a map of strings, i.e. map[string]*string
. In addition the same for lists (assuming lists cannot be sparse, i.e. []string
. Using $P
should generate the pointer type of the outer shape, *map[string]*string
and *[]string
. $P
should have no impact on the generate of nested members within collections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created, #149 for this.
...n/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/ShapeValueGenerator.java
Outdated
Show resolved
Hide resolved
codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/UnionGenerator.java
Outdated
Show resolved
Hide resolved
codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/UnionGenerator.java
Outdated
Show resolved
Hide resolved
codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/UnionGenerator.java
Outdated
Show resolved
Hide resolved
codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/SymbolVisitor.java
Outdated
Show resolved
Hide resolved
codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/UnionGenerator.java
Outdated
Show resolved
Hide resolved
...hy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/integration/ProtocolUtils.java
Outdated
Show resolved
Hide resolved
This updates the union design to make less use of interfaces.
b6f1049
to
3ef2d79
Compare
This updates generated unions. Now there will only be a single parent interface, and each member will only be a struct that implements that interface.
This also adds generation of unions to the protocol test generator.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.