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

feat: Add default trait support #1696

Merged
merged 7 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,8 @@ public struct Sha256TreeHashMiddleware<OperationStackInput, OperationStackOutput
context: Context
) async throws {
switch request.body {
case .data(let data):
guard let data = data else {
return
}
if !request.headers.exists(name: X_AMZ_CONTENT_SHA256_HEADER_NAME) {
let sha256 = try data.computeSHA256().encodeToHexString()
builder.withHeader(name: X_AMZ_CONTENT_SHA256_HEADER_NAME, value: sha256)
}
case .data:
break
jbelkins marked this conversation as resolved.
Show resolved Hide resolved
case .stream(let stream):
let streamBytes: Data?
let currentPosition = stream.position
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public extension Context {
get { attributes.get(key: businessMetricsKey) ?? [:] }
set(newPair) {
var combined = businessMetrics
combined.merge(newPair) { (current, new) in new }
combined.merge(newPair) { (_, new) in new }
attributes.set(key: businessMetricsKey, value: combined)
}
}
Expand Down Expand Up @@ -82,7 +82,7 @@ public let businessMetricsKey = AttributeKey<Dictionary<String, String>>(name: "
"SIGV4A_SIGNING" : "S" : Y
"RESOLVED_ACCOUNT_ID" : "T" :
*/
fileprivate func setFlagsIntoContext(
private func setFlagsIntoContext(
jbelkins marked this conversation as resolved.
Show resolved Hide resolved
config: UserAgentValuesFromConfig,
context: Context
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,20 @@
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "StringArrayEndpointParam"
BuildableName = "StringArrayEndpointParam"
BlueprintName = "StringArrayEndpointParam"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
Expand Down Expand Up @@ -409,6 +423,16 @@
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "StringArrayEndpointParamTests"
BuildableName = "StringArrayEndpointParamTests"
BlueprintName = "StringArrayEndpointParamTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class AWSJSON1_0ProtocolGenerator : AWSHTTPBindingProtocolGenerator(AWSJSONCusto
"SDKAppliedContentEncoding_awsJson1_0",
"SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsJson1_0",
)
override val tagsToIgnore = setOf("defaults")
override fun getProtocolHttpBindingResolver(ctx: ProtocolGenerator.GenerationContext, defaultContentType: String):
HttpBindingResolver = AWSJSONHttpBindingResolver(ctx, defaultContentType)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class AWSJSON1_1ProtocolGenerator : AWSHTTPBindingProtocolGenerator(AWSJSONCusto
"SDKAppliedContentEncoding_awsJson1_1",
"SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsJson1_1",
)
override val tagsToIgnore = setOf("defaults")
override fun getProtocolHttpBindingResolver(ctx: ProtocolGenerator.GenerationContext, defaultContentType: String):
HttpBindingResolver = AWSJSONHttpBindingResolver(ctx, defaultContentType)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ open class AWSQueryProtocolGenerator : AWSHTTPBindingProtocolGenerator(AWSQueryC
"SDKAppliedContentEncoding_awsQuery",
"SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsQuery",
)
override val tagsToIgnore = setOf("defaults")

override fun addProtocolSpecificMiddleware(ctx: ProtocolGenerator.GenerationContext, operation: OperationShape) {
super.addProtocolSpecificMiddleware(ctx, operation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class EC2QueryProtocolGenerator : AWSHTTPBindingProtocolGenerator(EC2QueryCustom
"SDKAppliedContentEncoding_ec2Query",
"SDKAppendsGzipAndIgnoresHttpProvidedEncoding_ec2Query"
)
override val tagsToIgnore = setOf("defaults")

override fun addProtocolSpecificMiddleware(ctx: ProtocolGenerator.GenerationContext, operation: OperationShape) {
super.addProtocolSpecificMiddleware(ctx, operation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class AWSRestJson1ProtocolGenerator : AWSHTTPBindingProtocolGenerator(RestJSONCu
override val testsToIgnore = setOf(
"SDKAppliedContentEncoding_restJson1",
"SDKAppendedGzipAfterProvidedEncoding_restJson1",
// This test is disabled until Smithy v1.51.0 with the fix for the test gets released.
"RestJsonClientIgnoresDefaultValuesIfMemberValuesArePresentInResponse"
jbelkins marked this conversation as resolved.
Show resolved Hide resolved
)
override val tagsToIgnore = setOf("defaults")
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class RestXMLProtocolGenerator : AWSHTTPBindingProtocolGenerator(RestXMLCustomiz
"S3PreservesEmbeddedDotSegmentInUriLabel", // moved to s3-tests.smithy
"S3PreservesLeadingDotSegmentInUriLabel", // moved to s3-tests.smithy
)
override val tagsToIgnore = setOf("defaults")

override fun generateDeserializers(ctx: ProtocolGenerator.GenerationContext) {
super.generateDeserializers(ctx)
Expand Down
Loading