From 1249c68d1bcae64c7008b5b8cb22b502570ec9fd Mon Sep 17 00:00:00 2001 From: Adam Thomas Date: Wed, 19 Jun 2024 10:33:10 -0700 Subject: [PATCH] Add protocol tests for sparse list primitives 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. --- .../model/restJson1/json-lists.smithy | 16 ++++++++++++++-- .../model/shared-types.smithy | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/smithy-aws-protocol-tests/model/restJson1/json-lists.smithy b/smithy-aws-protocol-tests/model/restJson1/json-lists.smithy index af76a3307ce..66333134434 100644 --- a/smithy-aws-protocol-tests/model/restJson1/json-lists.smithy +++ b/smithy-aws-protocol-tests/model/restJson1/json-lists.smithy @@ -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 @@ -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] } } ]) @@ -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] } } ]) @@ -372,4 +383,5 @@ operation SparseJsonLists { structure SparseJsonListsInputOutput { sparseStringList: SparseStringList + sparseShortList: SparseShortList } diff --git a/smithy-aws-protocol-tests/model/shared-types.smithy b/smithy-aws-protocol-tests/model/shared-types.smithy index b4e31ba4d69..f53e7d453eb 100644 --- a/smithy-aws-protocol-tests/model/shared-types.smithy +++ b/smithy-aws-protocol-tests/model/shared-types.smithy @@ -59,6 +59,11 @@ list ShortList { member: Short, } +@sparse +list SparseShortList { + member: Short +} + list IntegerList { member: Integer, }