Skip to content

Commit 4dad7bd

Browse files
ysaito1001unexge
authored andcommitted
Allow SDK to be built with unknown traits in models (upgrading Smithy to 1.29.0 as part of it) (#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 950ee78 commit 4dad7bd

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
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: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,8 +810,16 @@ class ServerProtocolTestGenerator(
810810
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsLongList", TestType.MalformedRequest),
811811
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsTimestampList", TestType.MalformedRequest),
812812
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsDateTimeList", TestType.MalformedRequest),
813-
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsHttpDateList_case0", TestType.MalformedRequest),
814-
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsHttpDateList_case1", TestType.MalformedRequest),
813+
FailingTest(
814+
RestJsonValidation,
815+
"RestJsonMalformedUniqueItemsHttpDateList_case0",
816+
TestType.MalformedRequest,
817+
),
818+
FailingTest(
819+
RestJsonValidation,
820+
"RestJsonMalformedUniqueItemsHttpDateList_case1",
821+
TestType.MalformedRequest,
822+
),
815823
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsEnumList", TestType.MalformedRequest),
816824
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsIntEnumList", TestType.MalformedRequest),
817825
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsListList", TestType.MalformedRequest),
@@ -830,6 +838,10 @@ class ServerProtocolTestGenerator(
830838
FailingTest(RestJsonValidation, "RestJsonMalformedEnumString_case1", TestType.MalformedRequest),
831839
FailingTest(RestJsonValidation, "RestJsonMalformedEnumUnion_case0", TestType.MalformedRequest),
832840
FailingTest(RestJsonValidation, "RestJsonMalformedEnumUnion_case1", TestType.MalformedRequest),
841+
842+
// TODO(https://github.com/awslabs/smithy/issues/1737): Specs on @internal, @tags, and enum values need to be clarified
843+
FailingTest(RestJsonValidation, "RestJsonMalformedEnumTraitString_case0", TestType.MalformedRequest),
844+
FailingTest(RestJsonValidation, "RestJsonMalformedEnumTraitString_case1", TestType.MalformedRequest),
833845
)
834846
private val RunOnly: Set<String>? = null
835847

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)