-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug where mixin cycles were incorrectly detected (#1628)
* Fix bug where mixin cycles were incorrectly detected when traits were filtered out on operations using a mixin * Remove added utility methods from Model * Removed unused test dependencies
- Loading branch information
Showing
4 changed files
with
228 additions
and
7 deletions.
There are no files selected for viewing
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
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
119 changes: 119 additions & 0 deletions
119
...-build/src/test/resources/software/amazon/smithy/build/transforms/mixin-cycle-test.smithy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
$version: "2.0" | ||
|
||
namespace smithy.example | ||
|
||
use smithy.example1#trait1 | ||
|
||
@trait | ||
@tags(["filter"]) | ||
structure filteredTrait {} | ||
|
||
@trait | ||
@tags(["unfiltered"]) | ||
structure unfilteredTrait {} | ||
|
||
@trait(selector: "resource") | ||
structure resourceTrait {} | ||
|
||
// RESOURCES | ||
@filteredTrait | ||
@unfilteredTrait | ||
resource ResourceWithMixin with [ ResourceMixin ] {} | ||
|
||
@mixin | ||
@resourceTrait | ||
resource ResourceMixin {} | ||
|
||
// OPERATIONS | ||
@filteredTrait | ||
@unfilteredTrait | ||
operation OperationWithMixin with [ OperationMixin ] { | ||
input := { | ||
@required | ||
@httpLabel | ||
myInputField: String, | ||
other: String | ||
} | ||
} | ||
|
||
@mixin | ||
operation OperationMixin { | ||
errors: [ | ||
ThrottlingException | ||
ValidationException | ||
] | ||
} | ||
|
||
@error("client") | ||
structure ThrottlingException { | ||
@required | ||
message: String | ||
} | ||
|
||
@error("client") | ||
structure ValidationException{ | ||
@required | ||
message: String | ||
} | ||
|
||
// STRUCTURES | ||
@filteredTrait | ||
@unfilteredTrait | ||
structure StructureWithMixin with [ StructureMixin ] { | ||
data: String | ||
} | ||
|
||
@mixin | ||
structure StructureMixin { | ||
field: String | ||
} | ||
|
||
// UNIONS | ||
@filteredTrait | ||
@unfilteredTrait | ||
union UnionWithMixin with [ UnionMixin ] { | ||
data: String | ||
} | ||
|
||
@mixin | ||
union UnionMixin { | ||
field: Integer | ||
} | ||
|
||
// MAPS | ||
@filteredTrait | ||
@unfilteredTrait | ||
map MapWithMixin with [MapMixin]{ | ||
key: String | ||
value: String | ||
} | ||
|
||
@mixin | ||
@length(min: 1, max: 2) | ||
map MapMixin { | ||
key: String | ||
value: String | ||
} | ||
|
||
// LISTS | ||
@filteredTrait | ||
@unfilteredTrait | ||
list ListWithMixin with [ListMixin]{ | ||
member: String | ||
} | ||
|
||
@mixin | ||
@length(min: 1, max: 2) | ||
list ListMixin { | ||
member: String | ||
} | ||
|
||
// STRINGS | ||
@filteredTrait | ||
@unfilteredTrait | ||
string StringWithMixin with [ StringMixin ] | ||
|
||
@pattern("^$") | ||
@mixin | ||
string StringMixin | ||
|
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