-
Notifications
You must be signed in to change notification settings - Fork 219
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
Fix allowUnknownTraits for projection with import #1685
Merged
Merged
Conversation
This file contains 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
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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
projectionUnknownTraitsAreAllowedWithFlag
did 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.