-
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.
Add test for synthetic box traits on mixins
This commit also fixes an issue where we would sometimes add empty apply statements to the JSON AST because a mixin introduces no traits. The AST parser now handles this without failing, and the model serializer no longer writes out empty apply blocks.
- Loading branch information
Showing
9 changed files
with
137 additions
and
20 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
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
8 changes: 8 additions & 0 deletions
8
smithy-model/src/test/resources/software/amazon/smithy/model/loader/ast-empty-apply-1.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,8 @@ | ||
{ | ||
"smithy": "2.0", | ||
"shapes": { | ||
"smithy.example#Foo": { | ||
"type": "string" | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
smithy-model/src/test/resources/software/amazon/smithy/model/loader/ast-empty-apply-2.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,8 @@ | ||
{ | ||
"smithy": "2.0", | ||
"shapes": { | ||
"smithy.example#Foo": { | ||
"type": "apply" | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...del/src/test/resources/software/amazon/smithy/model/loader/synthetic-boxing-mixins.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: "2.0" | ||
namespace smithy.example | ||
|
||
@mixin | ||
integer MixinInteger | ||
|
||
integer MixedInteger with [MixinInteger] | ||
|
||
@mixin | ||
structure MixinStruct { | ||
bar: MixedInteger = null | ||
} | ||
|
||
structure MixedStruct with [MixinStruct] {} |
28 changes: 28 additions & 0 deletions
28
...test/resources/software/amazon/smithy/model/loader/valid/mixins/no-empty-apply-types.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,28 @@ | ||
{ | ||
"smithy": "2.0", | ||
"shapes": { | ||
"smithy.example#MixedStruct": { | ||
"type": "structure", | ||
"mixins": [ | ||
{ | ||
"target": "smithy.example#MixinStruct" | ||
} | ||
], | ||
"members": {} | ||
}, | ||
"smithy.example#MixinStruct": { | ||
"type": "structure", | ||
"members": { | ||
"bar": { | ||
"target": "smithy.api#PrimitiveInteger", | ||
"traits": { | ||
"smithy.api#default": null | ||
} | ||
} | ||
}, | ||
"traits": { | ||
"smithy.api#mixin": {} | ||
} | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...st/resources/software/amazon/smithy/model/loader/valid/mixins/no-empty-apply-types.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: "2.0" | ||
namespace smithy.example | ||
|
||
@mixin | ||
structure MixinStruct { | ||
bar: PrimitiveInteger = null | ||
} | ||
|
||
structure MixedStruct with [MixinStruct] {} |