Skip to content

Commit

Permalink
Omit serializing empty http-query lists (#1629)
Browse files Browse the repository at this point in the history
  • Loading branch information
srchase authored Feb 22, 2023
1 parent 01a2d5b commit 57873f3
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
53 changes: 53 additions & 0 deletions smithy-aws-protocol-tests/model/restJson1/http-query.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,59 @@ structure OmitsNullSerializesEmptyStringInput {
emptyString: String,
}

/// Omits serializing empty lists. Because empty strings are serilized as
/// `Foo=`, empty lists cannot also be serialized as `Foo=` and instead
/// must be omitted.
@http(uri: "/OmitsSerializingEmptyLists", method: "POST")
@tags(["client-only"])
operation OmitsSerializingEmptyLists {
input: OmitsSerializingEmptyListsInput
}

apply OmitsSerializingEmptyLists @httpRequestTests([
{
id: "RestJsonOmitsEmptyListQueryValues",
documentation: "Supports omitting empty lists.",
protocol: restJson1,
method: "POST",
uri: "/OmitsSerializingEmptyLists",
body: "",
queryParams: [],
params: {
queryStringList: [],
queryIntegerList: [],
queryDoubleList: [],
queryBooleanList: [],
queryTimestampList: [],
queryEnumList: [],
queryIntegerEnumList: [],
}
}
])

structure OmitsSerializingEmptyListsInput {
@httpQuery("StringList")
queryStringList: StringList,

@httpQuery("IntegerList")
queryIntegerList: IntegerList,

@httpQuery("DoubleList")
queryDoubleList: DoubleList,

@httpQuery("BooleanList")
queryBooleanList: BooleanList,

@httpQuery("TimestampList")
queryTimestampList: TimestampList,

@httpQuery("EnumList")
queryEnumList: FooEnumList,

@httpQuery("IntegerEnumList")
queryIntegerEnumList: IntegerEnumList,
}

/// Automatically adds idempotency tokens.
@http(uri: "/QueryIdempotencyTokenAutoFill", method: "POST")
@tags(["client-only"])
Expand Down
1 change: 1 addition & 0 deletions smithy-aws-protocol-tests/model/restJson1/main.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ service RestJson {
ConstantAndVariableQueryString,
IgnoreQueryParamsInResponse,
OmitsNullSerializesEmptyString,
OmitsSerializingEmptyLists,
QueryIdempotencyTokenAutoFill,
QueryPrecedence,
QueryParamsAsStringListMap,
Expand Down

0 comments on commit 57873f3

Please sign in to comment.