Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,30 @@ protected Set<ShapeId> findInitialShapeIdsToConvert() {
.map(unionShape -> unionShape.getId())
.collect(Collectors.toSet());

// Collect map shapes
final Set<ShapeId> mapShapes = model
.getMapShapes()
.stream()
.map(Shape::getId)
.filter(this::isInServiceNamespace)
.collect(Collectors.toSet());

// Collect list shapes
final Set<ShapeId> listShapes = model
.getListShapes()
.stream()
.map(Shape::getId)
.filter(this::isInServiceNamespace)
.collect(Collectors.toSet());

// Collect structure shapes
final Set<ShapeId> structureShapes = model
.getStructureShapes()
.stream()
.map(Shape::getId)
.filter(this::isInServiceNamespace)
.collect(Collectors.toSet());

// TODO add smithy v2 Enums
// Collect enum shapes
final Set<ShapeId> enumShapes = model
Expand All @@ -277,6 +301,9 @@ protected Set<ShapeId> findInitialShapeIdsToConvert() {
orderedSet.addAll(unionShapes);
orderedSet.addAll(errorStructures);
orderedSet.addAll(enumShapes);
orderedSet.addAll(mapShapes);
orderedSet.addAll(listShapes);
orderedSet.addAll(structureShapes);
return orderedSet;
}

Expand Down Expand Up @@ -2014,9 +2041,9 @@ protected TypeConverter buildConverterFromMethodBodies(
// This is more controlled than exposing
// the NativeWrapper and the Dafny wrapped type.
final boolean isDependantModuleType =
ModelUtils.isReferenceDependantModuleType(
ModelUtils.isDependantModuleType(
shape,
nameResolver.namespaceForService()
nameResolver.serviceShape.getId().getNamespace()
);

// Make all converters public, because most need to be and it's not worth the trouble to hide the remaining few.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,19 @@ public static Boolean isReferenceDependantModuleType(
final String namespace
) {
if (shape.hasTrait(ReferenceTrait.class)) {
return !namespace.equalsIgnoreCase(shape.getId().getNamespace());
return isDependantModuleType(shape, namespace);
} else {
return false;
}
}

public static Boolean isDependantModuleType(
final Shape shape,
final String namespace
) {
final String shapeNamespace = shape.getId().getNamespace();
if (!shapeNamespace.toLowerCase().startsWith("smithy.api") && !namespace.equalsIgnoreCase(shapeNamespace)) {
return true;
} else {
return false;
}
Expand Down
Loading