Fix allowUnknownTraits for projection with import#1685
Merged
gosar merged 2 commits intosmithy-lang:mainfrom Mar 20, 2023
Merged
Fix allowUnknownTraits for projection with import#1685gosar merged 2 commits intosmithy-lang:mainfrom
gosar merged 2 commits intosmithy-lang:mainfrom
Conversation
Previously if SmithyBuild had a projection that imported a model that had an unknown trait, the allowUnknownTraits option wasn't allowing it.
gosar
commented
Mar 17, 2023
| @Test | ||
| public void allowsUnknownTraitWithFlag() throws Exception { | ||
| String model = Paths.get(getClass().getResource("unknown-trait.smithy").toURI()).toString(); | ||
| CliUtils.Result result = CliUtils.runSmithy("build", "--allow-unknown-traits", model); |
Contributor
Author
There was a problem hiding this comment.
This is similar to dumpsOutValidationErrorsAndFails above, but with the --allow-unknown-traits option making it succeed.
| "version": "1.0", | ||
| "projections": { | ||
| "exampleProjection": { | ||
| "imports": ["unknown-trait.smithy"] |
Contributor
Author
There was a problem hiding this comment.
kstich
reviewed
Mar 17, 2023
smithy-cli/src/main/java/software/amazon/smithy/cli/commands/BuildCommand.java
Outdated
Show resolved
Hide resolved
kstich
approved these changes
Mar 20, 2023
github-merge-queue bot
pushed a commit
to smithy-lang/smithy-rs
that referenced
this pull request
Apr 18, 2023
## 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>
github-merge-queue bot
pushed a commit
to smithy-lang/smithy-rs
that referenced
this pull request
Apr 20, 2023
… 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>
github-merge-queue bot
pushed a commit
to smithy-lang/smithy-rs
that referenced
this pull request
Apr 20, 2023
… 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>
unexge
pushed a commit
to smithy-lang/smithy-rs
that referenced
this pull request
Apr 24, 2023
… 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>
rcoh
pushed a commit
to smithy-lang/smithy-rs
that referenced
this pull request
Apr 24, 2023
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously if SmithyBuild had a projection that imported a model that had an unknown trait, the allowUnknownTraits option wasn't allowing it.
Added BuildCommand unit tests to show the broken behavior and fix working. Previously, the test case
projectionUnknownTraitsAreAllowedWithFlagdid not work without the code changes in this PR. Note, the test caseallowsUnknownTraitWithFlag(not using import) worked even before this change.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.