Skip to content

Commit

Permalink
Add protocol tests for sparse list primitives
Browse files Browse the repository at this point in the history
In some languages, like Java, Strings are naturally nullable and thus
handling sparse collections of String values is straightforward, but
sparse collection of values with primitives (such as shorts) may
introduce complexities.
  • Loading branch information
adamthom-amzn authored and JordonPhillips committed Jun 20, 2024
1 parent e8e104e commit 1249c68
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
16 changes: 14 additions & 2 deletions smithy-aws-protocol-tests/model/restJson1/json-lists.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use aws.protocoltests.shared#IntegerEnumList
use aws.protocoltests.shared#GreetingList
use aws.protocoltests.shared#IntegerList
use aws.protocoltests.shared#NestedStringList
use aws.protocoltests.shared#SparseShortList
use aws.protocoltests.shared#StringList
use aws.protocoltests.shared#SparseStringList
use aws.protocoltests.shared#StringSet
Expand Down Expand Up @@ -334,12 +335,17 @@ structure StructureListMember {
"sparseStringList": [
null,
"hi"
],
"sparseShortList": [
null,
2
]
}"""
bodyMediaType: "application/json"
headers: {"Content-Type": "application/json"}
params: {
sparseStringList: [null, "hi"]
sparseStringList: [null, "hi"],
sparseShortList: [null, 2]
}
}
])
Expand All @@ -354,12 +360,17 @@ structure StructureListMember {
"sparseStringList": [
null,
"hi"
],
"sparseShortList": [
null,
2
]
}"""
bodyMediaType: "application/json"
headers: {"Content-Type": "application/json"}
params: {
sparseStringList: [null, "hi"]
sparseStringList: [null, "hi"],
sparseShortList: [null, 2]
}
}
])
Expand All @@ -372,4 +383,5 @@ operation SparseJsonLists {

structure SparseJsonListsInputOutput {
sparseStringList: SparseStringList
sparseShortList: SparseShortList
}
5 changes: 5 additions & 0 deletions smithy-aws-protocol-tests/model/shared-types.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ list ShortList {
member: Short,
}

@sparse
list SparseShortList {
member: Short
}

list IntegerList {
member: Integer,
}
Expand Down

0 comments on commit 1249c68

Please sign in to comment.