Skip to content

Commit

Permalink
Allow SDK to be built with unknown traits in models (upgrading Smithy…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
ysaito1001 and ysaito1001 authored Apr 20, 2023
1 parent 437ae5b commit 92b0704
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions aws/sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ plugins {

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

val smithyVersion: String by project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -810,8 +810,16 @@ class ServerProtocolTestGenerator(
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsLongList", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsTimestampList", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsDateTimeList", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsHttpDateList_case0", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsHttpDateList_case1", TestType.MalformedRequest),
FailingTest(
RestJsonValidation,
"RestJsonMalformedUniqueItemsHttpDateList_case0",
TestType.MalformedRequest,
),
FailingTest(
RestJsonValidation,
"RestJsonMalformedUniqueItemsHttpDateList_case1",
TestType.MalformedRequest,
),
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsEnumList", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsIntEnumList", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedUniqueItemsListList", TestType.MalformedRequest),
Expand All @@ -830,6 +838,10 @@ class ServerProtocolTestGenerator(
FailingTest(RestJsonValidation, "RestJsonMalformedEnumString_case1", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedEnumUnion_case0", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedEnumUnion_case1", TestType.MalformedRequest),

// TODO(https://github.com/awslabs/smithy/issues/1737): Specs on @internal, @tags, and enum values need to be clarified
FailingTest(RestJsonValidation, "RestJsonMalformedEnumTraitString_case0", TestType.MalformedRequest),
FailingTest(RestJsonValidation, "RestJsonMalformedEnumTraitString_case1", TestType.MalformedRequest),
)
private val RunOnly: Set<String>? = null

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ kotlin.code.style=official

# codegen
smithyGradlePluginVersion=0.6.0
smithyVersion=1.28.1
smithyVersion=1.29.0

# kotlin
kotlinVersion=1.7.21
Expand Down

0 comments on commit 92b0704

Please sign in to comment.