-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw syntax exceptions on duplicate bindings
This commit updates the Smithy IDL parsing to throw when duplicate bindings or members are found in the following declarations: service, resource, and operation shapes, applied structure traits, and applied traits with members that are structures. This behavior is unsafe for model writers and shouldn't be valid.
- Loading branch information
Showing
13 changed files
with
62 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
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
1 change: 1 addition & 0 deletions
1
...st/resources/software/amazon/smithy/model/errorfiles/loader/dupe-operation-binding.errors
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 @@ | ||
[ERROR] -: Parse error at line 5, column 23 near `, | Model |
8 changes: 8 additions & 0 deletions
8
...st/resources/software/amazon/smithy/model/errorfiles/loader/dupe-operation-binding.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,8 @@ | ||
namespace com.foo | ||
|
||
operation GetFoo { | ||
input: GetFooInput, | ||
input: GetFooInput, | ||
} | ||
|
||
structure GetFooInput {} |
1 change: 1 addition & 0 deletions
1
...est/resources/software/amazon/smithy/model/errorfiles/loader/dupe-resource-binding.errors
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 @@ | ||
[ERROR] -: Parse error at line 8, column 22 near `, | Model |
11 changes: 11 additions & 0 deletions
11
...est/resources/software/amazon/smithy/model/errorfiles/loader/dupe-resource-binding.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,11 @@ | ||
namespace com.foo | ||
|
||
resource Foo { | ||
identifiers: { | ||
id: String, | ||
}, | ||
create: createFoo, | ||
create: createFoo, | ||
} | ||
|
||
operation createFoo {} |
1 change: 1 addition & 0 deletions
1
...test/resources/software/amazon/smithy/model/errorfiles/loader/dupe-service-binding.errors
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 @@ | ||
[ERROR] -: Parse error at line 5, column 26 near `, | Model |
6 changes: 6 additions & 0 deletions
6
...test/resources/software/amazon/smithy/model/errorfiles/loader/dupe-service-binding.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,6 @@ | ||
namespace com.foo | ||
|
||
service Foo { | ||
version: "2020-07-02", | ||
version: "2020-07-02", | ||
} |
1 change: 1 addition & 0 deletions
1
...t/resources/software/amazon/smithy/model/errorfiles/loader/dupe-trait-member-names.errors
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 @@ | ||
[ERROR] -: Parse error at line 5, column 19 near `, | Model |
7 changes: 7 additions & 0 deletions
7
...t/resources/software/amazon/smithy/model/errorfiles/loader/dupe-trait-member-names.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,7 @@ | ||
namespace com.foo | ||
|
||
@deprecated( | ||
message: "Foo", | ||
message: "Foo", | ||
) | ||
structure Foo {} |
1 change: 1 addition & 0 deletions
1
...st/resources/software/amazon/smithy/model/errorfiles/loader/dupe-trait-object-keys.errors
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 @@ | ||
[ERROR] -: Parse error at line 6, column 21 near `, | Model |
9 changes: 9 additions & 0 deletions
9
...st/resources/software/amazon/smithy/model/errorfiles/loader/dupe-trait-object-keys.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,9 @@ | ||
namespace com.foo | ||
|
||
@enum([ | ||
{ | ||
value: "foo", | ||
value: "foo", | ||
}, | ||
]) | ||
string Foo |