Skip to content

Commit

Permalink
Allow empty enum with non-empty mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewFossAWS committed May 25, 2023
1 parent f2a93bc commit c9c9689
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ public EnumShape build() {
private void addSyntheticEnumTrait() {
SyntheticEnumTrait.Builder builder = SyntheticEnumTrait.builder();
builder.sourceLocation(getSourceLocation());
for (MemberShape member : members.get().values()) {
Collection<MemberShape> memberShapes = NamedMemberUtils.computeMixinMembers(
getMixins(), members, getId(), getSourceLocation()).values();
for (MemberShape member : memberShapes) {
try {
builder.addEnum(EnumShape.enumDefinitionFromMember(member));
} catch (IllegalStateException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[ERROR] smithy.example#EmptyEnumMixin: enum must have at least one entry | Model
[ERROR] smithy.example#EmptyEnum: Cannot apply mixin to smithy.example#EmptyEnum: smithy.example#EmptyEnumMixin not found | Model
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$version: "2.0"

namespace smithy.example

@mixin
enum EmptyEnumMixin {}

enum EmptyEnum with [EmptyEnumMixin] {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$version: "2.0"

namespace smithy.example

@mixin
enum NonEmptyEnumMixin {
VALUE = "value"
}

enum NonEmptyEnum with [NonEmptyEnumMixin] {}

0 comments on commit c9c9689

Please sign in to comment.