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 to 1.50.0 #3728

Merged
merged 9 commits into from
Jul 5, 2024
11 changes: 1 addition & 10 deletions codegen-client-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,7 @@ val allCodegenTests = listOf(
ClientTest(
"aws.protocoltests.restjson#RestJsonExtras",
"rest_json_extras",
dependsOn = listOf(
"rest-json-extras.smithy",
// TODO(https://github.com/smithy-lang/smithy/pull/2310): Can be deleted when consumed in next Smithy version.
"rest-json-extras-2310.smithy",
// TODO(https://github.com/smithy-lang/smithy/pull/2314): Can be deleted when consumed in next Smithy version.
"rest-json-extras-2314.smithy",
// TODO(https://github.com/smithy-lang/smithy/pull/2315): Can be deleted when consumed in next Smithy version.
// TODO(https://github.com/smithy-lang/smithy/pull/2331): Can be deleted when consumed in next Smithy version.
"rest-json-extras-2315.smithy",
),
dependsOn = listOf("rest-json-extras.smithy"),
),
ClientTest("aws.protocoltests.misc#MiscService", "misc", dependsOn = listOf("misc.smithy")),
ClientTest("aws.protocoltests.restxml#RestXml", "rest_xml", addMessageToErrors = false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package software.amazon.smithy.rust.codegen.client.smithy.generators.protocol

import software.amazon.smithy.model.node.NumberNode
import software.amazon.smithy.model.shapes.DoubleShape
import software.amazon.smithy.model.shapes.FloatShape
import software.amazon.smithy.model.shapes.OperationShape
Expand All @@ -27,7 +28,9 @@ import software.amazon.smithy.rust.codegen.core.smithy.generators.protocol.Broke
import software.amazon.smithy.rust.codegen.core.smithy.generators.protocol.FailingTest
import software.amazon.smithy.rust.codegen.core.smithy.generators.protocol.ProtocolSupport
import software.amazon.smithy.rust.codegen.core.smithy.generators.protocol.ProtocolTestGenerator
import software.amazon.smithy.rust.codegen.core.smithy.generators.protocol.ServiceShapeId
import software.amazon.smithy.rust.codegen.core.smithy.generators.protocol.ServiceShapeId.AWS_JSON_10
import software.amazon.smithy.rust.codegen.core.smithy.generators.protocol.ServiceShapeId.REST_JSON
import software.amazon.smithy.rust.codegen.core.smithy.generators.protocol.TestCase
import software.amazon.smithy.rust.codegen.core.util.PANIC
import software.amazon.smithy.rust.codegen.core.util.dq
Expand Down Expand Up @@ -73,7 +76,38 @@ class ClientProtocolTestGenerator(
FailingTest.RequestTest(AWS_JSON_10, "AwsJson10ClientPopulatesDefaultsValuesWhenMissingInResponse"),
FailingTest.RequestTest(AWS_JSON_10, "AwsJson10ClientUsesExplicitlyProvidedMemberValuesOverDefaults"),
FailingTest.RequestTest(AWS_JSON_10, "AwsJson10ClientPopulatesDefaultValuesInInput"),
FailingTest.RequestTest(REST_JSON, "RestJsonClientPopulatesDefaultValuesInInput"),
FailingTest.RequestTest(REST_JSON, "RestJsonClientUsesExplicitlyProvidedMemberValuesOverDefaults"),
)

private val BrokenTests:
Set<BrokenTest> =
setOf(
BrokenTest.ResponseTest(
ServiceShapeId.REST_JSON,
"RestJsonClientIgnoresDefaultValuesIfMemberValuesArePresentInResponse",
howToFixItFn = ::fixRestJsonClientIgnoresDefaultValuesIfMemberValuesArePresentInResponse,
inAtLeast = setOf("1.50.0"),
trackedIn =
setOf(
// TODO(https://github.com/smithy-lang/smithy/pull/2341)
"https://github.com/smithy-lang/smithy/pull/2341",
),
),
)

private fun fixRestJsonClientIgnoresDefaultValuesIfMemberValuesArePresentInResponse(
testCase: TestCase.ResponseTest,
): TestCase.ResponseTest {
val fixedParams =
testCase.testCase.params.toBuilder().withMember("defaultTimestamp", NumberNode.from(2)).build()
return TestCase.ResponseTest(
testCase.testCase.toBuilder()
.params(fixedParams)
.build(),
testCase.targetShape,
)
}
}

override val appliesTo: AppliesTo
Expand All @@ -85,7 +119,7 @@ class ClientProtocolTestGenerator(
override val disabledTests: Set<String>
get() = emptySet()
override val brokenTests: Set<BrokenTest>
get() = emptySet()
get() = BrokenTests

override val logger: Logger = Logger.getLogger(javaClass.name)

Expand Down
35 changes: 0 additions & 35 deletions codegen-core/common-test-models/rest-json-extras-2310.smithy

This file was deleted.

39 changes: 0 additions & 39 deletions codegen-core/common-test-models/rest-json-extras-2314.smithy

This file was deleted.

133 changes: 0 additions & 133 deletions codegen-core/common-test-models/rest-json-extras-2315.smithy

This file was deleted.

7 changes: 0 additions & 7 deletions codegen-core/common-test-models/rest-json-extras.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ service RestJsonExtras {
CaseInsensitiveErrorOperation,
EmptyStructWithContentOnWireOp,
QueryPrecedence,
// TODO(https://github.com/smithy-lang/smithy/pull/2314)
HttpPayloadTraits2,
// TODO(https://github.com/smithy-lang/smithy/pull/2310)
MalformedContentTypeWithBody2,
// TODO(https://github.com/smithy-lang/smithy/pull/2315)
HttpEnumPayload2,
HttpStringPayload2,
],
errors: [ExtraError]
}
Expand Down
53 changes: 0 additions & 53 deletions codegen-core/common-test-models/rest-xml-extras.smithy

This file was deleted.

16 changes: 1 addition & 15 deletions codegen-server-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,7 @@ val allCodegenTests = "../codegen-core/common-test-models".let { commonModels ->
CodegenTest(
"aws.protocoltests.restjson#RestJsonExtras",
"rest_json_extras",
imports = listOf(
"$commonModels/rest-json-extras.smithy",
// TODO(https://github.com/smithy-lang/smithy/pull/2310): Can be deleted when consumed in next Smithy version.
"$commonModels/rest-json-extras-2310.smithy",
// TODO(https://github.com/smithy-lang/smithy/pull/2314): Can be deleted when consumed in next Smithy version.
"$commonModels/rest-json-extras-2314.smithy",
// TODO(https://github.com/smithy-lang/smithy/pull/2315): Can be deleted when consumed in next Smithy version.
// TODO(https://github.com/smithy-lang/smithy/pull/2331): Can be deleted when consumed in next Smithy version.
"$commonModels/rest-json-extras-2315.smithy",
),
imports = listOf("$commonModels/rest-json-extras.smithy"),
),
CodegenTest(
"aws.protocoltests.restjson.validation#RestJsonValidation",
Expand Down Expand Up @@ -100,11 +91,6 @@ val allCodegenTests = "../codegen-core/common-test-models".let { commonModels ->
"pokemon-service-awsjson-server-sdk",
imports = listOf("$commonModels/pokemon-awsjson.smithy", "$commonModels/pokemon-common.smithy"),
),
CodegenTest(
"aws.protocoltests.restxml#RestXmlExtras",
"rest_xml_extras",
imports = listOf("$commonModels/rest-xml-extras.smithy"),
),
)
}

Expand Down
Loading