diff --git a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/DocumentMemberSerVisitor.java b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/DocumentMemberSerVisitor.java index 1f6cd08b9e6..aef7283c753 100644 --- a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/DocumentMemberSerVisitor.java +++ b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/DocumentMemberSerVisitor.java @@ -17,8 +17,6 @@ import software.amazon.smithy.codegen.core.CodegenException; import software.amazon.smithy.codegen.core.Symbol; -import software.amazon.smithy.model.knowledge.HttpBinding.Location; -import software.amazon.smithy.model.knowledge.HttpBindingIndex; import software.amazon.smithy.model.shapes.BigDecimalShape; import software.amazon.smithy.model.shapes.BigIntegerShape; import software.amazon.smithy.model.shapes.BlobShape; @@ -43,6 +41,7 @@ import software.amazon.smithy.model.shapes.StructureShape; import software.amazon.smithy.model.shapes.TimestampShape; import software.amazon.smithy.model.shapes.UnionShape; +import software.amazon.smithy.model.traits.TimestampFormatTrait; import software.amazon.smithy.model.traits.TimestampFormatTrait.Format; import software.amazon.smithy.typescript.codegen.TypeScriptDependency; import software.amazon.smithy.typescript.codegen.integration.ProtocolGenerator.GenerationContext; @@ -234,8 +233,9 @@ public final String memberShape(MemberShape shape) { @Override public String timestampShape(TimestampShape shape) { - HttpBindingIndex httpIndex = HttpBindingIndex.of(context.getModel()); - Format format = httpIndex.determineTimestampFormat(shape, Location.DOCUMENT, defaultTimestampFormat); + Format format = shape.getTrait(TimestampFormatTrait.class) + .map(trait -> Format.fromString(trait.getValue())) + .orElse(defaultTimestampFormat); return HttpProtocolGeneratorUtils.getTimestampInputParam(context, dataSource, shape, format); } diff --git a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/knowledge/SerdeElisionIndex.java b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/knowledge/SerdeElisionIndex.java index 30028eaff41..b8850183400 100644 --- a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/knowledge/SerdeElisionIndex.java +++ b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/knowledge/SerdeElisionIndex.java @@ -18,6 +18,7 @@ import software.amazon.smithy.model.traits.MediaTypeTrait; import software.amazon.smithy.model.traits.SparseTrait; import software.amazon.smithy.model.traits.StreamingTrait; +import software.amazon.smithy.model.traits.Trait; import software.amazon.smithy.utils.MapUtils; /** @@ -28,7 +29,7 @@ */ public class SerdeElisionIndex implements KnowledgeIndex { private final Map elisionBinding = new HashMap<>(); - private final Map mutatingTraits = MapUtils.of( + private final Map> mutatingTraits = MapUtils.of( "jsonName", JsonNameTrait.class, "streaming", StreamingTrait.class, "mediaType", MediaTypeTrait.class, @@ -58,7 +59,7 @@ private boolean canBeElided(Shape shape, Model model) { } private boolean hasMutatingTraits(Shape shape, Model model) { - for (Map.Entry entry : mutatingTraits.entrySet()) { + for (Map.Entry> entry : mutatingTraits.entrySet()) { if (shape.hasTrait(entry.getValue())) { return true; }