-
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 dedicated io transform leaving unused shapes (#1419)
This commit changes the way `CreateDedicatedInputOutput` transform checks for singular references to a shape being used as input or output in an operation. It now checks to make sure the shape is only referenced by the specified operation. This fixes an edge case where a shape was being used as both the input and output for an operation, and would be left unused in the model after the transformation was applied. Two new test cases were added to verify the behavior when a shape is used as both input and output. Fixes: #1373
- Loading branch information
1 parent
dcafe54
commit f915ead
Showing
6 changed files
with
141 additions
and
54 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
18 changes: 18 additions & 0 deletions
18
...odel/transform/dedicated-input-output/creates-dedicated-heuristic-for-shared-after.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,18 @@ | ||
$version: "2.0" | ||
|
||
namespace smithy.example | ||
|
||
// `@output` is added to `GetFooOutput` | ||
// and a dedicated input shape is added | ||
operation GetFoo { | ||
input: GetFooInput | ||
output: GetFooOutput | ||
} | ||
|
||
@input | ||
structure GetFooInput { | ||
} | ||
|
||
@output | ||
structure GetFooOutput { | ||
} |
12 changes: 12 additions & 0 deletions
12
...del/transform/dedicated-input-output/creates-dedicated-heuristic-for-shared-before.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,12 @@ | ||
$version: "2.0" | ||
|
||
namespace smithy.example | ||
|
||
// `GetFooOutput` is shared by input and output | ||
// and has the right naming for an output shape | ||
operation GetFoo { | ||
input: GetFooOutput | ||
output: GetFooOutput | ||
} | ||
|
||
structure GetFooOutput {} |
16 changes: 16 additions & 0 deletions
16
...thy/model/transform/dedicated-input-output/removes-disconnected-shared-shape-after.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,16 @@ | ||
$version: "2.0" | ||
|
||
namespace smithy.example | ||
|
||
// Dedicated input and output are created | ||
// and the old shared shape removed | ||
operation GetFoo { | ||
input: GetFooInput | ||
output: GetFooOutput | ||
} | ||
|
||
@input | ||
structure GetFooInput {} | ||
|
||
@output | ||
structure GetFooOutput {} |
12 changes: 12 additions & 0 deletions
12
...hy/model/transform/dedicated-input-output/removes-disconnected-shared-shape-before.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,12 @@ | ||
$version: "2.0" | ||
|
||
namespace smithy.example | ||
|
||
// A shape is shared by both input and output | ||
// but is not named properly for an output | ||
operation GetFoo { | ||
input: MyGetFooOutput | ||
output: MyGetFooOutput | ||
} | ||
|
||
structure MyGetFooOutput {} |