Skip to content

Commit 5d3973d

Browse files
committed
Exclude structures with smithy.api to be added to the type-mappings
1 parent 880d375 commit 5d3973d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

codegen/plugins/types-codegen/src/main/java/software/amazon/smithy/java/codegen/types/generators/TypeMappingGenerator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.EnumSet;
99
import java.util.HashMap;
1010
import java.util.Map;
11+
import java.util.Set;
1112
import java.util.function.Consumer;
1213
import software.amazon.smithy.codegen.core.Symbol;
1314
import software.amazon.smithy.codegen.core.directed.CustomizeDirective;
@@ -22,7 +23,7 @@
2223
public final class TypeMappingGenerator
2324
implements Consumer<CustomizeDirective<CodeGenerationContext, JavaCodegenSettings>> {
2425
private static final String PROPERTY_FILE = "META-INF/smithy-java/type-mappings.properties";
25-
private static final String SYNTHETIC_NAMESPACE = "smithy.synthetic";
26+
private static final Set<String> EXCLUDED_NAMESPACE = Set.of("smithy.synthetic", "smithy.api");
2627
private static final EnumSet<ShapeType> GENERATED_TYPES = EnumSet.of(
2728
ShapeType.STRUCTURE,
2829
ShapeType.UNION,
@@ -37,7 +38,7 @@ public void accept(CustomizeDirective<CodeGenerationContext, JavaCodegenSettings
3738
for (var shape : directive.connectedShapes().values()) {
3839
var shapeId = shape.getId();
3940
// only add mappings for shapes that generate a class
40-
if (GENERATED_TYPES.contains(shape.getType()) && !SYNTHETIC_NAMESPACE.equals(shapeId.getNamespace())) {
41+
if (GENERATED_TYPES.contains(shape.getType()) && !EXCLUDED_NAMESPACE.contains(shapeId.getNamespace())) {
4142
var symbol = directive.symbolProvider().toSymbol(shape);
4243
// Skip any external types used in this package
4344
if (symbol.getProperty(SymbolProperties.EXTERNAL_TYPE).isPresent()) {

0 commit comments

Comments
 (0)