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

Bump smithy version to 1.52 #3887

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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 @@ -102,7 +102,7 @@ apply SayHello @httpResponseTests([{
listValue: [],
mapValue: {},
doubleListValue: []
document: null
document: {}
nested: { a: "" }
},
code: 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,17 +617,26 @@ class HttpBindingGenerator(
)(this)
}

rustBlock("for ${loopVariable.name} in ${context.valueExpression.asRef()}") {
this.renderHeaderValue(
headerName,
loopVariable,
model.expectShape(shape.member.target),
isMultiValuedHeader = true,
timestampFormat,
renderErrorMessage,
serializeIfDefault = true,
shape.member,
)
rustTemplate(
"""
// Empty vecs in headers are serialized as the empty string
if ${context.valueExpression.asRef()}.is_empty() {
builder = builder.header("$headerName", "");
}""",
)
rustBlock("else") {
rustBlock("for ${loopVariable.name} in ${context.valueExpression.asRef()}") {
this.renderHeaderValue(
headerName,
loopVariable,
model.expectShape(shape.member.target),
isMultiValuedHeader = true,
timestampFormat,
renderErrorMessage,
serializeIfDefault = true,
shape.member,
)
}
}
}

Expand Down Expand Up @@ -671,14 +680,12 @@ class HttpBindingGenerator(
val safeName = safeName("formatted")
rustTemplate(
"""
let $safeName = $formatted;
if !$safeName.is_empty() {
let header_value = $safeName;
let header_value: #{HeaderValue} = header_value.parse().map_err(|err| {
#{invalid_field_error:W}
})?;
builder = builder.header("$headerName", header_value);
}
let header_value = $formatted;
let header_value: #{HeaderValue} = header_value.parse().map_err(|err| {
#{invalid_field_error:W}
})?;
builder = builder.header("$headerName", header_value);

""",
"HeaderValue" to RuntimeType.Http.resolve("HeaderValue"),
"invalid_field_error" to renderErrorMessage("header_value"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ open class RpcV2Cbor(val codegenContext: CodegenContext) : Protocol {
override val defaultTimestampFormat: TimestampFormatTrait.Format = TimestampFormatTrait.Format.EPOCH_SECONDS

override fun additionalRequestHeaders(operationShape: OperationShape): List<Pair<String, String>> =
listOf("smithy-protocol" to "rpc-v2-cbor")
listOf("smithy-protocol" to "rpc-v2-cbor", "Accept" to "application/cbor")

override fun additionalResponseHeaders(operationShape: OperationShape): List<Pair<String, String>> =
listOf("smithy-protocol" to "rpc-v2-cbor")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ smithy.rs.runtime.crate.unstable.version=0.60.6
kotlin.code.style=official
# codegen
smithyGradlePluginVersion=0.9.0
smithyVersion=1.51.0
smithyVersion=1.52.0
allowLocalDeps=false
# kotlin
kotlinVersion=1.9.20
Expand Down
Loading