-
Notifications
You must be signed in to change notification settings - Fork 33
chore: Update Smithy to 1.59.0 #937
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
Changes from all commits
d0e98d6
8c9f0fc
9e930c8
d764e2f
8cb4cbd
dbc4e3e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ import software.amazon.smithy.model.Model | |
import software.amazon.smithy.model.node.ArrayNode | ||
import software.amazon.smithy.model.node.BooleanNode | ||
import software.amazon.smithy.model.node.Node | ||
import software.amazon.smithy.model.node.NodeType | ||
import software.amazon.smithy.model.node.NodeVisitor | ||
import software.amazon.smithy.model.node.NullNode | ||
import software.amazon.smithy.model.node.NumberNode | ||
|
@@ -54,6 +55,13 @@ class ShapeValueGenerator( | |
shape: Shape, | ||
params: Node, | ||
) { | ||
// If the node for the value to be written is NULL, then the value for this shape is not present. | ||
// Just write a Swift `nil` and stop rendering. | ||
if (params.type == NodeType.NULL) { | ||
writer.writeInline("nil") | ||
return | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We were incorrectly rendering the expected value when a collection or aggregate shape when it is supposed to be absent (i.e. "null" in the Smithy node tree for expected value.) This if-else handles that case. |
||
val nodeVisitor = ShapeValueNodeVisitor(writer, this, shape) | ||
|
||
when (shape.type) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,8 +112,11 @@ open class OperationEndpointResolverMiddleware( | |
} | ||
} | ||
} | ||
|
||
writer.openBlock("let endpointParamsBlock = { [config] (context: \$N) in", "}", SmithyTypes.Context) { | ||
writer.openBlock( | ||
"let endpointParamsBlock = { [config] (context: \$N) in", | ||
"}", | ||
SmithyTypes.Context, | ||
) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reformat |
||
writer.write("EndpointParams(\$L)", params.joinToString(", ")) | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,6 +180,10 @@ class HttpHeaderProvider( | |
val mapValueShapeTargetSymbol = ctx.symbolProvider.toSymbol(mapValueShapeTarget) | ||
|
||
writer.openBlock("for (prefixHeaderMapKey, prefixHeaderMapValue) in $memberName { ", "}") { | ||
// Don't write a prefix header over a specific header that was also written to this request. | ||
// See the HttpEmptyPrefixHeadersRequestClient protocol tests on the REST protocols. | ||
writer.write("guard !items.exists(name: \"$paramName\\(prefixHeaderMapKey)\") else { continue }") | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New protocol tests specify that specific headers bound to names can overwrite prefix headers. This |
||
if (mapValueShapeTarget is CollectionShape) { | ||
writer.openBlock("prefixHeaderMapValue.forEach { headerValue in ", "}") { | ||
if (mapValueShapeTargetSymbol.isBoxed()) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored to avoid simultaneously holding two locks.