Skip to content
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 2 commits into from
Mar 20, 2023

Conversation

gosar
Copy link
Contributor

@gosar gosar commented Mar 17, 2023

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 case allowsUnknownTraitWithFlag (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.

Previously if SmithyBuild had a projection that imported a model that had an
unknown trait, the allowUnknownTraits option wasn't allowing it.
@gosar gosar requested a review from a team as a code owner March 17, 2023 07:32
@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);
Copy link
Contributor Author

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"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gosar gosar merged commit 73f6d3a into smithy-lang:main Mar 20, 2023
@gosar gosar deleted the allowUnknownTraits-import branch March 20, 2023 18:43
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants