Skip to content

Commit b9a7e3b

Browse files
authored
Allow SDK to be built with unknown traits in models (#2547)
## Motivation and Context Addresses #2104 ## Description This PR allows us to build `aws-sdk-rust` even with unknown traits present in the AWS models. This requires `Smithy` 1.29.0 that includes [support](smithy-lang/smithy#1685) for an extension property, [allowUnknownTraits](https://smithy.io/2.0/guides/building-models/gradle-plugin.html?highlight=allowunknowntraits#smithy-extension-properties). ## Testing Manually added a unknown trait into an AWS model like so: ``` diff --git a/aws/sdk/aws-models/sts.json b/aws/sdk/aws-models/sts.json --- a/aws/sdk/aws-models/sts.json +++ b/aws/sdk/aws-models/sts.json @@ -69,6 +69,7 @@ "aws.auth#sigv4": { "name": "sts" }, + "aws.protocols#awsQuery2": {}, "aws.protocols#awsQuery": {}, ``` and confirmed `/gradlew :aws:sdk:assemble` built SDK successfully. Also verified that without `allowUnknownTraits = true` in `aws/sdk/build.gradle.kts`, `/gradlew :aws:sdk:assemble` failed with the above unknown trait. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --------- Co-authored-by: Yuki Saito <awsaito@amazon.com>
1 parent 80f25d4 commit b9a7e3b

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

aws/sdk/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ plugins {
2020

2121
configure<software.amazon.smithy.gradle.SmithyExtension> {
2222
smithyBuildConfigs = files(buildDir.resolve("smithy-build.json"))
23+
allowUnknownTraits = true
2324
}
2425

2526
val smithyVersion: String by project

codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocolTestGenerator.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,8 @@ class ServerProtocolTestGenerator(
828828
FailingTest(RestJsonValidation, "RestJsonMalformedEnumMapValue_case1", TestType.MalformedRequest),
829829
FailingTest(RestJsonValidation, "RestJsonMalformedEnumString_case0", TestType.MalformedRequest),
830830
FailingTest(RestJsonValidation, "RestJsonMalformedEnumString_case1", TestType.MalformedRequest),
831+
FailingTest(RestJsonValidation, "RestJsonMalformedEnumTraitString_case0", TestType.MalformedRequest),
832+
FailingTest(RestJsonValidation, "RestJsonMalformedEnumTraitString_case1", TestType.MalformedRequest),
831833
FailingTest(RestJsonValidation, "RestJsonMalformedEnumUnion_case0", TestType.MalformedRequest),
832834
FailingTest(RestJsonValidation, "RestJsonMalformedEnumUnion_case1", TestType.MalformedRequest),
833835
)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ kotlin.code.style=official
1818

1919
# codegen
2020
smithyGradlePluginVersion=0.6.0
21-
smithyVersion=1.28.1
21+
smithyVersion=1.29.0
2222

2323
# kotlin
2424
kotlinVersion=1.7.21

0 commit comments

Comments
 (0)