From 598a3ec7a6580b4f2f63e35110ff0bcbdbea1a39 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Tue, 30 Sep 2025 22:29:40 +0000 Subject: [PATCH 1/3] Remove usage of deprecated APIs from SerdeElisionIndex --- .../typescript/codegen/knowledge/SerdeElisionIndex.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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..65461bea2c2 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 @@ -13,6 +13,7 @@ import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.ToShapeId; +import software.amazon.smithy.model.traits.Trait; import software.amazon.smithy.model.traits.IdempotencyTokenTrait; import software.amazon.smithy.model.traits.JsonNameTrait; import software.amazon.smithy.model.traits.MediaTypeTrait; @@ -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; } From 7d838011c2a92cf6c1afee9e5b420a083950cf66 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Tue, 30 Sep 2025 22:38:20 +0000 Subject: [PATCH 2/3] Remove usage of deprecated APIs from DocumentMemberSerVisitor --- .../codegen/integration/DocumentMemberSerVisitor.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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..0b677cdbf8d 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 @@ -18,7 +18,7 @@ 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.traits.TimestampFormatTrait; import software.amazon.smithy.model.shapes.BigDecimalShape; import software.amazon.smithy.model.shapes.BigIntegerShape; import software.amazon.smithy.model.shapes.BlobShape; @@ -234,8 +234,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); } From 94f329eb505934e8c501b5a85d92664ffe2b3d88 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Tue, 30 Sep 2025 23:02:08 +0000 Subject: [PATCH 3/3] Fix checkStyle errors --- .../codegen/integration/DocumentMemberSerVisitor.java | 3 +-- .../smithy/typescript/codegen/knowledge/SerdeElisionIndex.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) 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 0b677cdbf8d..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.traits.TimestampFormatTrait; 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; 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 65461bea2c2..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 @@ -13,12 +13,12 @@ import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.ToShapeId; -import software.amazon.smithy.model.traits.Trait; import software.amazon.smithy.model.traits.IdempotencyTokenTrait; import software.amazon.smithy.model.traits.JsonNameTrait; 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; /**