-
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.
It is a common requirement to need to apply multiple traits to the same shape. However, this previously required that the shape ID of the trait is restated for each applied trait. This added a lot of noise in models, especially when applying traits to members. With this change, multiple traits can be applied to a shape using a single statement by wrapping traits in a block ("{" and "}").
- Loading branch information
Showing
12 changed files
with
143 additions
and
9 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
6 changes: 6 additions & 0 deletions
6
...rces/software/amazon/smithy/model/loader/invalid/apply/apply-block-missing-closing.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 @@ | ||
// Parse error at line 7, column 1 near ``: Expected: '}' | ||
$version: "1.1" | ||
namespace com.foo | ||
|
||
apply SomeShape { | ||
@deprecated |
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
...src/test/resources/software/amazon/smithy/model/loader/valid/apply/apply-block-empty.json
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,13 @@ | ||
{ | ||
"smithy": "1.1", | ||
"shapes": { | ||
"smithy.example#Foo": { | ||
"type": "structure", | ||
"members": { | ||
"baz": { | ||
"target": "smithy.api#String" | ||
} | ||
} | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...c/test/resources/software/amazon/smithy/model/loader/valid/apply/apply-block-empty.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 @@ | ||
$version: "1.1" | ||
namespace smithy.example | ||
|
||
structure Foo { | ||
baz: String, | ||
} | ||
|
||
// Block apply statements may be empty. | ||
apply Foo$baz {} |
2 changes: 1 addition & 1 deletion
2
.../model/loader/valid/apply-statements.json → .../loader/valid/apply/apply-statements.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"smithy": "1.0", | ||
"smithy": "1.1", | ||
"shapes": { | ||
"smithy.example#Foo": { | ||
"type": "structure", | ||
|
1 change: 1 addition & 0 deletions
1
...odel/loader/valid/apply-statements.smithy → ...oader/valid/apply/apply-statements.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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
$version: "1.1" | ||
namespace smithy.example | ||
|
||
structure Foo { | ||
|
18 changes: 18 additions & 0 deletions
18
...test/resources/software/amazon/smithy/model/loader/valid/apply/apply-with-whitespace.json
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 @@ | ||
{ | ||
"smithy": "1.1", | ||
"shapes": { | ||
"smithy.example#Foo": { | ||
"type": "structure", | ||
"members": { | ||
"baz": { | ||
"target": "smithy.api#String", | ||
"traits": { | ||
"smithy.api#documentation": "Hi", | ||
"smithy.api#sensitive": {}, | ||
"smithy.api#deprecated": {} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...st/resources/software/amazon/smithy/model/loader/valid/apply/apply-with-whitespace.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,14 @@ | ||
$version: "1.1" | ||
namespace smithy.example | ||
|
||
structure Foo { | ||
baz: String, | ||
} | ||
|
||
apply Foo$baz{@documentation("Hi") @sensitive | ||
|
||
|
||
|
||
|
||
|
||
@deprecated} |
18 changes: 18 additions & 0 deletions
18
...test/resources/software/amazon/smithy/model/loader/valid/apply/block-apply-statement.json
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 @@ | ||
{ | ||
"smithy": "1.1", | ||
"shapes": { | ||
"smithy.example#Foo": { | ||
"type": "structure", | ||
"members": { | ||
"baz": { | ||
"target": "smithy.api#String", | ||
"traits": { | ||
"smithy.api#documentation": "Hi", | ||
"smithy.api#sensitive": {}, | ||
"smithy.api#deprecated": {} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...st/resources/software/amazon/smithy/model/loader/valid/apply/block-apply-statement.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: "1.1" | ||
namespace smithy.example | ||
|
||
structure Foo { | ||
baz: String, | ||
} | ||
|
||
apply Foo$baz { | ||
@documentation("Hi") | ||
@sensitive | ||
@deprecated | ||
} |