diff --git a/clients/client-s3/src/protocols/Aws_restXml.ts b/clients/client-s3/src/protocols/Aws_restXml.ts index 279f1fcc8bbc..95fc3f89b58d 100644 --- a/clients/client-s3/src/protocols/Aws_restXml.ts +++ b/clients/client-s3/src/protocols/Aws_restXml.ts @@ -8579,7 +8579,7 @@ const serializeAws_restXmlLambdaFunctionConfigurationList = ( const serializeAws_restXmlLifecycleExpiration = (input: LifecycleExpiration, context: __SerdeContext): any => { const bodyNode = new __XmlNode("LifecycleExpiration"); if (input.Date != null) { - const node = __XmlNode.of("Date", input.Date.toISOString().split(".")[0] + "Z").withName("Date"); + const node = __XmlNode.of("Date", (input.Date.toISOString().split(".")[0] + "Z").toString()).withName("Date"); bodyNode.addChildNode(node); } if (input.Days != null) { @@ -8980,7 +8980,7 @@ const serializeAws_restXmlObjectLockRetention = (input: ObjectLockRetention, con } if (input.RetainUntilDate != null) { const node = __XmlNode - .of("Date", input.RetainUntilDate.toISOString().split(".")[0] + "Z") + .of("Date", (input.RetainUntilDate.toISOString().split(".")[0] + "Z").toString()) .withName("RetainUntilDate"); bodyNode.addChildNode(node); } @@ -9729,7 +9729,7 @@ const serializeAws_restXmlTopicConfigurationList = (input: TopicConfiguration[], const serializeAws_restXmlTransition = (input: Transition, context: __SerdeContext): any => { const bodyNode = new __XmlNode("Transition"); if (input.Date != null) { - const node = __XmlNode.of("Date", input.Date.toISOString().split(".")[0] + "Z").withName("Date"); + const node = __XmlNode.of("Date", (input.Date.toISOString().split(".")[0] + "Z").toString()).withName("Date"); bodyNode.addChildNode(node); } if (input.Days != null) { diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/XmlShapeSerVisitor.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/XmlShapeSerVisitor.java index 6295b51801b6..05bef81c14aa 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/XmlShapeSerVisitor.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/XmlShapeSerVisitor.java @@ -16,6 +16,7 @@ package software.amazon.smithy.aws.typescript.codegen; import java.util.Map; +import java.util.Optional; import java.util.function.Supplier; import software.amazon.smithy.codegen.core.CodegenException; import software.amazon.smithy.model.Model; @@ -236,17 +237,20 @@ void serializeNamedMember( // Grab the target shape so we can use a member serializer on it. Shape target = context.getModel().expectShape(memberShape.getTarget()); XmlMemberSerVisitor inputVisitor = getMemberVisitor(inputLocation.get()); - // Collected members must be handled with flattening and renaming. if (serializationReturnsArray(target)) { serializeNamedMemberFromArray(context, locationName, memberShape, target, inputVisitor); } else { // Handle @timestampFormat on members not just the targeted shape. String valueProvider; - if (memberShape.hasTrait(TimestampFormatTrait.class)) { + if (memberShape.hasTrait(TimestampFormatTrait.class) || target.hasTrait(TimestampFormatTrait.class)) { + Optional timestampFormat = memberShape.getTrait(TimestampFormatTrait.class); + if (timestampFormat.isEmpty()) { + timestampFormat = target.getTrait(TimestampFormatTrait.class); + } valueProvider = inputVisitor.getAsXmlText(target, AwsProtocolUtils.getInputTimestampValueProvider(context, memberShape, - TIMESTAMP_FORMAT, inputLocation.get()) + ".toString()"); + timestampFormat.get().getFormat(), inputLocation.get()) + ".toString()"); } else { valueProvider = target.accept(inputVisitor); }