diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/loader/LoaderShapeMap.java b/smithy-model/src/main/java/software/amazon/smithy/model/loader/LoaderShapeMap.java index 669b88f6338..122bd5cd20c 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/loader/LoaderShapeMap.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/loader/LoaderShapeMap.java @@ -229,7 +229,7 @@ private List sort() { emitUnresolved(shape, e.getUnresolved(), e.getResolved()); } } - return Collections.emptyList(); + return e.getResolved(); } } diff --git a/smithy-model/src/test/java/software/amazon/smithy/model/loader/ModelAssemblerTest.java b/smithy-model/src/test/java/software/amazon/smithy/model/loader/ModelAssemblerTest.java index 4067b70662c..3c542b41f9d 100644 --- a/smithy-model/src/test/java/software/amazon/smithy/model/loader/ModelAssemblerTest.java +++ b/smithy-model/src/test/java/software/amazon/smithy/model/loader/ModelAssemblerTest.java @@ -49,6 +49,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Set; import java.util.function.Supplier; import java.util.stream.Collectors; import org.junit.jupiter.api.AfterEach; @@ -1391,4 +1392,28 @@ public void handlesMultipleInheritanceForMixinMembers() { String actualPattern = shape.expectTrait(PatternTrait.class).getValue(); assertThat(actualPattern, equalTo("baz")); } + + @Test + public void loadsShapesWhenThereAreUnresolvedMixins() { + String modelText = "$version: \"2\"\n" + + "namespace com.foo\n" + + "\n" + + "string Foo\n" + + "@mixin\n" + + "structure Bar {}\n" + + "structure Baz with [Unknown] {}\n"; + ValidatedResult result = Model.assembler() + .addUnparsedModel("foo.smithy", modelText) + .assemble(); + + assertThat(result.isBroken(), is(true)); + assertThat(result.getResult().isPresent(), is(true)); + Set fooShapes = result.getResult().get().getShapeIds().stream() + .filter(id -> id.getNamespace().equals("com.foo")) + .collect(Collectors.toSet()); + assertThat(fooShapes, containsInAnyOrder( + ShapeId.from("com.foo#Foo"), + ShapeId.from("com.foo#Bar") + )); + } }