-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge aggregate, structure shape grammar/parsing (#1790)
This commit combines aggregate shapes (list, map, union) and structure shapes in the grammar and parser. Previously, the way these shapes were defined only differed by aggregate shapes not allowing `for <resource>` syntax. With this change, aggregate shapes can now use `for <resource>` syntax and elide resource identifiers/properties. The parser was also updated so parsing inline structures uses the same method of parsing aggregate shapes. Tests making sure `for <resource>` couldn't be used with non structure shapes were removed, and tests were added for verifying `for <resource>` behavior with lists, maps, and unions. The tests added for list/map/union elided members in elided-members.smithy mirror the tests for structure shapes in the same file. This also updates the naming of shape productions in the grammar.
- Loading branch information
1 parent
ead65d6
commit 4784858
Showing
7 changed files
with
365 additions
and
75 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
10 changes: 10 additions & 0 deletions
10
...ources/software/amazon/smithy/model/errorfiles/loader/invalid-list-and-map-elision.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,10 @@ | ||
[ERROR] com.test#WrongMemberList: Missing required member of shape `com.test#WrongMemberList`: member | Model | ||
[ERROR] com.test#WrongMemberList: List shapes may only have a `member` member, but found `id` | Model | ||
[ERROR] com.test#ExtraElidedMemberList: List shapes may only have a `member` member, but found `other` | Model | ||
[ERROR] com.test#ConflictingTypesList$member: Member conflicts with an inherited mixin member: `com.test#MixinList$member` | Model | ||
[ERROR] com.test#WrongMembersMap: Missing required members of shape `com.test#WrongMembersMap`: key, value | Model | ||
[ERROR] com.test#WrongMembersMap: Map shapes may only have `key` and `value` members, but found `id` | Model | ||
[ERROR] com.test#WrongMembersMap: Map shapes may only have `key` and `value` members, but found `other` | Model | ||
[ERROR] com.test#ExtraMemberMap: Map shapes may only have `key` and `value` members, but found `other` | Model | ||
[ERROR] com.test#ConflictingTypesMap$key: Member conflicts with an inherited mixin member: `com.test#MixinMap$key` | Model | ||
[ERROR] com.test#ConflictingTypesMap$value: Member conflicts with an inherited mixin member: `com.test#MixinMap$value` | Model |
55 changes: 55 additions & 0 deletions
55
...ources/software/amazon/smithy/model/errorfiles/loader/invalid-list-and-map-elision.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,55 @@ | ||
$version: "2.0" | ||
|
||
namespace com.test | ||
|
||
resource MyResource { | ||
identifiers: { | ||
id: String | ||
member: String | ||
key: String | ||
} | ||
properties: { | ||
value: String | ||
other: String | ||
} | ||
} | ||
|
||
list WrongMemberList for MyResource { | ||
$id | ||
} | ||
|
||
list ExtraElidedMemberList for MyResource { | ||
$member | ||
$other | ||
} | ||
|
||
@mixin | ||
list MixinList { | ||
member: Integer | ||
} | ||
|
||
list ConflictingTypesList for MyResource with [MixinList] { | ||
$member | ||
} | ||
|
||
map WrongMembersMap for MyResource { | ||
$id | ||
$other | ||
} | ||
|
||
map ExtraMemberMap for MyResource { | ||
$key | ||
$value | ||
$other | ||
} | ||
|
||
@mixin | ||
map MixinMap { | ||
key: Integer | ||
value: Integer | ||
} | ||
|
||
map ConflictingTypesMap for MyResource with [MixinMap] { | ||
$key | ||
$value | ||
} |
14 changes: 0 additions & 14 deletions
14
...tware/amazon/smithy/model/loader/invalid/elision/elided-union-member-from-resource.smithy
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.