Skip to content

Commit dcd85fd

Browse files
authored
chore: Update Smithy to 1.59.0 (#937)
1 parent b3b139d commit dcd85fd

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

Sources/SmithyHTTPAPI/Headers.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,9 @@ extension Headers: Equatable {
191191
/// - rhs: The second `Headers` to compare.
192192
/// - Returns: `true` if the two values are equal irrespective of order, otherwise `false`.
193193
public static func == (lhs: Headers, rhs: Headers) -> Bool {
194-
lhs.access { lhsHeaders in
195-
rhs.access { rhsHeaders in
196-
lhsHeaders.sorted() == rhsHeaders.sorted()
197-
}
198-
}
194+
let lhsHeaders = lhs.access { $0 }.sorted()
195+
let rhsHeaders = rhs.access { $0 }.sorted()
196+
return lhsHeaders == rhsHeaders
199197
}
200198
}
201199

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kotlin.code.style=official
33
# config
44

55
# codegen
6-
smithyVersion=1.54.0
6+
smithyVersion=1.59.0
77
smithyGradleVersion=0.6.0
88

99
# kotlin

smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ShapeValueGenerator.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import software.amazon.smithy.model.Model
1010
import software.amazon.smithy.model.node.ArrayNode
1111
import software.amazon.smithy.model.node.BooleanNode
1212
import software.amazon.smithy.model.node.Node
13+
import software.amazon.smithy.model.node.NodeType
1314
import software.amazon.smithy.model.node.NodeVisitor
1415
import software.amazon.smithy.model.node.NullNode
1516
import software.amazon.smithy.model.node.NumberNode
@@ -54,6 +55,13 @@ class ShapeValueGenerator(
5455
shape: Shape,
5556
params: Node,
5657
) {
58+
// If the node for the value to be written is NULL, then the value for this shape is not present.
59+
// Just write a Swift `nil` and stop rendering.
60+
if (params.type == NodeType.NULL) {
61+
writer.writeInline("nil")
62+
return
63+
}
64+
5765
val nodeVisitor = ShapeValueNodeVisitor(writer, this, shape)
5866

5967
when (shape.type) {

smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/OperationEndpointResolverMiddleware.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,11 @@ open class OperationEndpointResolverMiddleware(
112112
}
113113
}
114114
}
115-
116-
writer.openBlock("let endpointParamsBlock = { [config] (context: \$N) in", "}", SmithyTypes.Context) {
115+
writer.openBlock(
116+
"let endpointParamsBlock = { [config] (context: \$N) in",
117+
"}",
118+
SmithyTypes.Context,
119+
) {
117120
writer.write("EndpointParams(\$L)", params.joinToString(", "))
118121
}
119122
}

smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/middlewares/providers/HttpHeaderProvider.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ class HttpHeaderProvider(
180180
val mapValueShapeTargetSymbol = ctx.symbolProvider.toSymbol(mapValueShapeTarget)
181181

182182
writer.openBlock("for (prefixHeaderMapKey, prefixHeaderMapValue) in $memberName { ", "}") {
183+
// Don't write a prefix header over a specific header that was also written to this request.
184+
// See the HttpEmptyPrefixHeadersRequestClient protocol tests on the REST protocols.
185+
writer.write("guard !items.exists(name: \"$paramName\\(prefixHeaderMapKey)\") else { continue }")
186+
183187
if (mapValueShapeTarget is CollectionShape) {
184188
writer.openBlock("prefixHeaderMapValue.forEach { headerValue in ", "}") {
185189
if (mapValueShapeTargetSymbol.isBoxed()) {

0 commit comments

Comments
 (0)