Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add protocol tests of timestampFormat on target shapes #1440

Merged
merged 2 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
75 changes: 75 additions & 0 deletions smithy-aws-protocol-tests/model/awsQuery/xml-structs.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,26 @@ apply XmlTimestamps @httpResponseTests([
dateTime: 1398796238
}
},
{
id: "QueryXmlTimestampsWithDateTimeOnTargetFormat",
documentation: "Ensures that the timestampFormat of date-time on the target shape works like normal timestamps",
protocol: awsQuery,
code: 200,
body: """
<XmlTimestampsResponse xmlns="https://example.com/">
<XmlTimestampsResult>
<dateTimeOnTarget>2014-04-29T18:30:38Z</dateTimeOnTarget>
</XmlTimestampsResult>
</XmlTimestampsResponse>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "text/xml"
},
params: {
dateTimeOnTarget: 1398796238
}
},
{
id: "QueryXmlTimestampsWithEpochSecondsFormat",
documentation: "Ensures that the timestampFormat of epoch-seconds works",
Expand All @@ -290,6 +310,26 @@ apply XmlTimestamps @httpResponseTests([
epochSeconds: 1398796238
}
},
{
id: "QueryXmlTimestampsWithEpochSecondsOnTargetFormat",
documentation: "Ensures that the timestampFormat of epoch-seconds on the target shape works",
protocol: awsQuery,
code: 200,
body: """
<XmlTimestampsResponse xmlns="https://example.com/">
<XmlTimestampsResult>
<epochSecondsOnTarget>1398796238</epochSecondsOnTarget>
</XmlTimestampsResult>
</XmlTimestampsResponse>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "text/xml"
},
params: {
epochSecondsOnTarget: 1398796238
}
},
{
id: "QueryXmlTimestampsWithHttpDateFormat",
documentation: "Ensures that the timestampFormat of http-date works",
Expand All @@ -310,19 +350,54 @@ apply XmlTimestamps @httpResponseTests([
httpDate: 1398796238
}
},
{
id: "QueryXmlTimestampsWithHttpDateOnTargetFormat",
documentation: "Ensures that the timestampFormat of http-date on the target shape works",
protocol: awsQuery,
code: 200,
body: """
<XmlTimestampsResponse xmlns="https://example.com/">
<XmlTimestampsResult>
<httpDateOnTarget>Tue, 29 Apr 2014 18:30:38 GMT</httpDateOnTarget>
</XmlTimestampsResult>
</XmlTimestampsResponse>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "text/xml"
},
params: {
httpDateOnTarget: 1398796238
}
},
])

@timestampFormat("date-time")
timestamp DateTimeTimestamp

@timestampFormat("epoch-seconds")
timestamp EpochSecondsTimestamp

@timestampFormat("http-date")
timestamp HttpDateTimestamp
JordonPhillips marked this conversation as resolved.
Show resolved Hide resolved

structure XmlTimestampsOutput {
normal: Timestamp,

@timestampFormat("date-time")
dateTime: Timestamp,

dateTimeOnTarget: DateTimeTimestamp,

@timestampFormat("epoch-seconds")
epochSeconds: Timestamp,

epochSecondsOnTarget: EpochSecondsTimestamp,

@timestampFormat("http-date")
httpDate: Timestamp,

httpDateOnTarget: HttpDateTimestamp,
}

/// This example serializes enums as top level properties, in lists, sets, and maps.
Expand Down
72 changes: 72 additions & 0 deletions smithy-aws-protocol-tests/model/ec2Query/xml-structs.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,25 @@ apply XmlTimestamps @httpResponseTests([
dateTime: 1398796238
}
},
{
id: "Ec2XmlTimestampsWithDateTimeOnTargetFormat",
documentation: "Ensures that the timestampFormat of date-time on the target shape works like normal timestamps",
protocol: ec2Query,
code: 200,
body: """
<XmlTimestampsResponse xmlns="https://example.com/">
<dateTimeOnTarget>2014-04-29T18:30:38Z</dateTimeOnTarget>
<RequestId>requestid</RequestId>
</XmlTimestampsResponse>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "text/xml;charset=UTF-8"
},
params: {
dateTimeOnTarget: 1398796238
}
},
{
id: "Ec2XmlTimestampsWithEpochSecondsFormat",
documentation: "Ensures that the timestampFormat of epoch-seconds works",
Expand All @@ -281,6 +300,25 @@ apply XmlTimestamps @httpResponseTests([
epochSeconds: 1398796238
}
},
{
id: "Ec2XmlTimestampsWithEpochSecondsOnTargetFormat",
documentation: "Ensures that the timestampFormat of epoch-seconds on the target shape works",
protocol: ec2Query,
code: 200,
body: """
<XmlTimestampsResponse xmlns="https://example.com/">
<epochSecondsOnTarget>1398796238</epochSecondsOnTarget>
<RequestId>requestid</RequestId>
</XmlTimestampsResponse>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "text/xml;charset=UTF-8"
},
params: {
epochSecondsOnTarget: 1398796238
}
},
{
id: "Ec2XmlTimestampsWithHttpDateFormat",
documentation: "Ensures that the timestampFormat of http-date works",
Expand All @@ -300,19 +338,53 @@ apply XmlTimestamps @httpResponseTests([
httpDate: 1398796238
}
},
{
id: "Ec2XmlTimestampsWithHttpDateOnTargetFormat",
documentation: "Ensures that the timestampFormat of http-date on the target shape works",
protocol: ec2Query,
code: 200,
body: """
<XmlTimestampsResponse xmlns="https://example.com/">
<httpDateOnTarget>Tue, 29 Apr 2014 18:30:38 GMT</httpDateOnTarget>
<RequestId>requestid</RequestId>
</XmlTimestampsResponse>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "text/xml;charset=UTF-8"
},
params: {
httpDateOnTarget: 1398796238
}
},
])

@timestampFormat("date-time")
timestamp DateTimeTimestamp

@timestampFormat("epoch-seconds")
timestamp EpochSecondsTimestamp

@timestampFormat("http-date")
timestamp HttpDateTimestamp

structure XmlTimestampsOutput {
normal: Timestamp,

@timestampFormat("date-time")
dateTime: Timestamp,

dateTimeOnTarget: DateTimeTimestamp,

@timestampFormat("epoch-seconds")
epochSeconds: Timestamp,

epochSecondsOnTarget: EpochSecondsTimestamp,

@timestampFormat("http-date")
httpDate: Timestamp,

httpDateOnTarget: HttpDateTimestamp,
}

/// This example serializes enums as top level properties, in lists, sets, and maps.
Expand Down
120 changes: 120 additions & 0 deletions smithy-aws-protocol-tests/model/restJson1/json-structs.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,24 @@ apply JsonTimestamps @httpRequestTests([
dateTime: 1398796238
}
},
{
id: "RestJsonJsonTimestampsWithDateTimeOnTargetFormat",
documentation: "Ensures that the timestampFormat of date-time on the target shape works like normal timestamps",
protocol: restJson1,
method: "POST",
uri: "/JsonTimestamps",
body: """
{
"dateTimeOnTarget": "2014-04-29T18:30:38Z"
}""",
bodyMediaType: "application/json",
headers: {
"Content-Type": "application/json"
},
params: {
dateTimeOnTarget: 1398796238
}
},
{
id: "RestJsonJsonTimestampsWithEpochSecondsFormat",
documentation: "Ensures that the timestampFormat of epoch-seconds works",
Expand All @@ -413,6 +431,24 @@ apply JsonTimestamps @httpRequestTests([
epochSeconds: 1398796238
}
},
{
id: "RestJsonJsonTimestampsWithEpochSecondsOnTargetFormat",
documentation: "Ensures that the timestampFormat of epoch-seconds on the target shape works",
protocol: restJson1,
method: "POST",
uri: "/JsonTimestamps",
body: """
{
"epochSecondsOnTarget": 1398796238
}""",
bodyMediaType: "application/json",
headers: {
"Content-Type": "application/json"
},
params: {
epochSecondsOnTarget: 1398796238
}
},
{
id: "RestJsonJsonTimestampsWithHttpDateFormat",
documentation: "Ensures that the timestampFormat of http-date works",
Expand All @@ -431,6 +467,24 @@ apply JsonTimestamps @httpRequestTests([
httpDate: 1398796238
}
},
{
id: "RestJsonJsonTimestampsWithHttpDateOnTargetFormat",
documentation: "Ensures that the timestampFormat of http-date on the target shape works",
protocol: restJson1,
method: "POST",
uri: "/JsonTimestamps",
body: """
{
"httpDateOnTarget": "Tue, 29 Apr 2014 18:30:38 GMT"
}""",
bodyMediaType: "application/json",
headers: {
"Content-Type": "application/json"
},
params: {
httpDateOnTarget: 1398796238
}
},
])

apply JsonTimestamps @httpResponseTests([
Expand Down Expand Up @@ -468,6 +522,23 @@ apply JsonTimestamps @httpResponseTests([
dateTime: 1398796238
}
},
{
id: "RestJsonJsonTimestampsWithDateTimeOnTargetFormat",
documentation: "Ensures that the timestampFormat of date-time on the target shape works like normal timestamps",
protocol: restJson1,
code: 200,
body: """
{
"dateTimeOnTarget": "2014-04-29T18:30:38Z"
}""",
bodyMediaType: "application/json",
headers: {
"Content-Type": "application/json"
},
params: {
dateTimeOnTarget: 1398796238
}
},
{
id: "RestJsonJsonTimestampsWithEpochSecondsFormat",
documentation: "Ensures that the timestampFormat of epoch-seconds works",
Expand All @@ -485,6 +556,23 @@ apply JsonTimestamps @httpResponseTests([
epochSeconds: 1398796238
}
},
{
id: "RestJsonJsonTimestampsWithEpochSecondsOnTargetFormat",
documentation: "Ensures that the timestampFormat of epoch-seconds on the target shape works",
protocol: restJson1,
code: 200,
body: """
{
"epochSecondsOnTarget": 1398796238
}""",
bodyMediaType: "application/json",
headers: {
"Content-Type": "application/json"
},
params: {
epochSecondsOnTarget: 1398796238
}
},
{
id: "RestJsonJsonTimestampsWithHttpDateFormat",
documentation: "Ensures that the timestampFormat of http-date works",
Expand All @@ -502,19 +590,51 @@ apply JsonTimestamps @httpResponseTests([
httpDate: 1398796238
}
},
{
id: "RestJsonJsonTimestampsWithHttpDateOnTargetFormat",
documentation: "Ensures that the timestampFormat of http-date on the target shape works",
protocol: restJson1,
code: 200,
body: """
{
"httpDateOnTarget": "Tue, 29 Apr 2014 18:30:38 GMT"
}""",
bodyMediaType: "application/json",
headers: {
"Content-Type": "application/json"
},
params: {
httpDateOnTarget: 1398796238
}
},
])

@timestampFormat("date-time")
timestamp DateTimeTimestamp

@timestampFormat("epoch-seconds")
timestamp EpochSecondsTimestamp

@timestampFormat("http-date")
timestamp HttpDateTimestamp

structure JsonTimestampsInputOutput {
normal: Timestamp,

@timestampFormat("date-time")
dateTime: Timestamp,

dateTimeOnTarget: DateTimeTimestamp,

@timestampFormat("epoch-seconds")
epochSeconds: Timestamp,

epochSecondsOnTarget: EpochSecondsTimestamp,

@timestampFormat("http-date")
httpDate: Timestamp,

httpDateOnTarget: HttpDateTimestamp,
}

/// This example serializes enums as top level properties, in lists, sets, and maps.
Expand Down
Loading