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

Upgrade Smithy #1330

Merged
merged 11 commits into from
Apr 21, 2022
Merged
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
6 changes: 6 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ message = "Bump [MSRV](https://github.com/awslabs/aws-sdk-rust#supported-rust-ve
references = ["smithy-rs#1318"]
meta = { "breaking" = true, "tada" = false, "bug" = false }
author = "Velfi"

[[smithy-rs]]
message = "Upgrade to Smithy 1.21.0"
references = ["smithy-rs#1330"]
meta = { "breaking" = false, "tada" = false, "bug" = false }
author = "jdisanti"
6 changes: 1 addition & 5 deletions aws/sdk-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,5 @@ publishing {
artifact(sourcesJar)
}
}
repositories {
maven {
url = uri("$buildDir/repository")
}
}
repositories { maven { url = uri("$buildDir/repository") } }
}
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
buildscript {
repositories {
mavenCentral()
google()
}

Expand Down
9 changes: 2 additions & 7 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ plugins {
jacoco
}
repositories {
maven("https://plugins.gradle.org/m2")
mavenCentral()
google()
}

// Load properties manually to avoid hard coding smithy version
Expand All @@ -21,12 +22,6 @@ val props = Properties().apply {

val smithyVersion = props["smithyVersion"]

buildscript {
repositories {
mavenCentral()
}
}

dependencies {
api("software.amazon.smithy:smithy-codegen-core:$smithyVersion")
implementation("software.amazon.smithy:smithy-utils:$smithyVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ class ServerProtocolTestGenerator(
// corresponding Unicode code point. That is the "form feed" 0x0c character. When printing it,
// it gets written as "\f", which is an invalid Rust escape sequence: https://static.rust-lang.org/doc/master/reference.html#literals
// So we need to write the corresponding Rust Unicode escape sequence to make the program compile.
"#{SmithyHttpServer}::body::Body::from(#{Bytes}::from_static(b${body.replace("\u000c", "\\u{000c}").dq()}))"
"#{SmithyHttpServer}::body::Body::from(#{Bytes}::from_static(${body.replace("\u000c", "\\u{000c}").dq()}.as_bytes()))"
} else {
"#{SmithyHttpServer}::body::Body::empty()"
}
Expand Down Expand Up @@ -652,13 +652,13 @@ class ServerProtocolTestGenerator(
private val ExpectFail = setOf<FailingTest>(
// Headers.
FailingTest(RestJson, "RestJsonHttpWithHeadersButNoPayload", TestType.Request),
FailingTest(RestJson, "RestJsonInputAndOutputWithQuotedStringHeaders", TestType.Response),

FailingTest(RestJson, "RestJsonEndpointTrait", TestType.Request),
FailingTest(RestJson, "RestJsonEndpointTraitWithHostLabel", TestType.Request),
FailingTest(RestJson, "RestJsonStreamingTraitsRequireLengthWithBlob", TestType.Response),
FailingTest(RestJson, "RestJsonHttpWithEmptyBlobPayload", TestType.Request),
FailingTest(RestJson, "RestJsonHttpWithEmptyStructurePayload", TestType.Request),
FailingTest(RestJson, "RestJsonHttpResponseCodeDefaultsToModeledCode", TestType.Response),

FailingTest(RestJson, "RestJsonWithBodyExpectsApplicationJsonAccept", TestType.MalformedRequest),
FailingTest(RestJson, "RestJsonWithPayloadExpectsImpliedAccept", TestType.MalformedRequest),
Expand Down Expand Up @@ -708,6 +708,7 @@ class ServerProtocolTestGenerator(
FailingTest(RestJson, "RestJsonPathTimestampDefaultRejectsUTCOffsets", TestType.MalformedRequest),
FailingTest(RestJson, "RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case13", TestType.MalformedRequest),
FailingTest(RestJson, "RestJsonMalformedUnionNoFieldsSet", TestType.MalformedRequest),
FailingTest(RestJson, "RestJsonMalformedSetDuplicateBlobs", TestType.MalformedRequest),

FailingTest(RestJsonValidation, "RestJsonMalformedEnumList_case0", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedEnumList_case1", TestType.MalformedRequest),
Expand All @@ -727,6 +728,7 @@ class ServerProtocolTestGenerator(
FailingTest(RestJsonValidation, "RestJsonMalformedLengthMapOverride_case1", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedLengthStringOverride_case0", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedLengthStringOverride_case1", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedLengthStringOverride_case2", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedLengthBlob_case0", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedLengthBlob_case1", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedLengthList_case0", TestType.MalformedRequest),
Expand All @@ -741,6 +743,7 @@ class ServerProtocolTestGenerator(
FailingTest(RestJsonValidation, "RestJsonMalformedLengthMapValue_case1", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedLengthString_case0", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedLengthString_case1", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedLengthString_case2", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedPatternListOverride_case0", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedPatternListOverride_case1", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedPatternMapKeyOverride_case0", TestType.MalformedRequest),
Expand Down
40 changes: 0 additions & 40 deletions codegen-test/model/rest-json-extras.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,6 @@ use aws.api#service
use smithy.test#httpRequestTests
use smithy.test#httpResponseTests

// TODO(https://github.com/awslabs/smithy/pull/1049): Remove this once the test case in Smithy is fixed
apply InputAndOutputWithHeaders @httpResponseTests([
{
id: "FIXED_RestJsonInputAndOutputWithQuotedStringHeaders",
documentation: "Tests responses with string list header bindings that require quoting",
protocol: restJson1,
code: 200,
headers: {
"X-StringList": "\"b,c\", \"\\\"def\\\"\", a"
},
params: {
headerStringList: ["b,c", "\"def\"", "a"]
}
}
])

// TODO(https://github.com/awslabs/smithy/pull/1042): Remove this once the test case in Smithy is fixed
apply PostPlayerAction @httpRequestTests([
{
id: "FIXED_RestJsonInputUnionWithUnitMember",
documentation: "Unit types in unions are serialized like normal structures in requests.",
protocol: restJson1,
method: "POST",
"uri": "/PostPlayerInput",
body: """
{
"action": {
"quit": {}
}
}""",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/json"},
params: {
action: {
quit: {}
}
}
}
])

apply QueryPrecedence @httpRequestTests([
{
id: "UrlParamsKeyEncoding",
Expand Down
6 changes: 1 addition & 5 deletions codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,5 @@ publishing {
artifact(sourcesJar)
}
}
repositories {
maven {
url = uri("$buildDir/repository")
}
}
repositories { maven { url = uri("$buildDir/repository") } }
}
Original file line number Diff line number Diff line change
Expand Up @@ -494,13 +494,7 @@ class ProtocolTestGenerator(
private val RestXml = "aws.protocoltests.restxml#RestXml"
private val AwsQuery = "aws.protocoltests.query#AwsQuery"
private val Ec2Query = "aws.protocoltests.ec2#AwsEc2"
private val ExpectFail = setOf<FailingTest>(
// TODO(https://github.com/awslabs/smithy/pull/1049): Remove this once the test case in Smithy is fixed
FailingTest(RestJson, "RestJsonInputAndOutputWithQuotedStringHeaders", Action.Response),
// TODO(https://github.com/awslabs/smithy/pull/1042): Remove this once the test case in Smithy is fixed
FailingTest(RestJson, "RestJsonInputUnionWithUnitMember", Action.Request),
FailingTest("${RestJson}Extras", "RestJsonInputUnionWithUnitMember", Action.Request),
)
private val ExpectFail = setOf<FailingTest>()
private val RunOnly: Set<String>? = null

// These tests are not even attempted to be generated, either because they will not compile
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ smithy.rs.runtime.crate.version=0.40.2
kotlin.code.style=official

# codegen
smithyVersion=1.16.1
smithyVersion=1.21.0

# kotlin
kotlinVersion=1.4.21
Expand Down
9 changes: 0 additions & 9 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
* SPDX-License-Identifier: Apache-2.0.
*/

pluginManagement {
repositories {
mavenCentral()
maven("https://plugins.gradle.org/m2/")
google()
gradlePluginPortal()
}
}

rootProject.name = "software.amazon.smithy.rust.codegen.smithy-rs"
enableFeaturePreview("GRADLE_METADATA")

Expand Down