Skip to content

Commit

Permalink
Add compliance test for sparse query parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
denisrosca committed Jun 13, 2024
1 parent 8eb295c commit 115e47a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
27 changes: 26 additions & 1 deletion modules/protocol-tests/resources/META-INF/smithy/Pizza.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use alloy#simpleRestJson
service PizzaAdminService {
version: "1.0.0",
errors: [GenericServerError, GenericClientError],
operations: [AddMenuItem, GetMenu, Version, Health, HeaderEndpoint, RoundTrip, GetEnum, GetIntEnum, CustomCode, HttpPayloadWithDefault]
operations: [AddMenuItem, GetMenu, Version, Health, HeaderEndpoint, RoundTrip, GetEnum, GetIntEnum, CustomCode, HttpPayloadWithDefault, SparseQueryParam]
}

@http(method: "POST", uri: "/restaurant/{restaurant}/menu/item", code: 201)
Expand Down Expand Up @@ -316,3 +316,28 @@ structure HttpPayloadWithDefaultInputOutput {
@default("default value")
body: String,
}


@readonly
@http(uri: "/sparseQueryParam", method: "GET")
operation SparseQueryParam {
input: SparseQueryParamInput,
output: SparseQueryParamOutput
}

structure SparseQueryParamInput {
@httpQuery("foo")
@required
foo: FooList
}

structure SparseQueryParamOutput {
@httpPayload
@required
foo: FooList
}

@sparse
list FooList {
member: String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
$version: "2.0"

namespace alloy.test

use alloy#simpleRestJson
use smithy.test#httpRequestTests
use smithy.test#httpResponseTests

apply SparseQueryParam @httpRequestTests([
{
id: "SparseQueryParam"
protocol: simpleRestJson
method: "GET"
uri: "/sparse-query-param"
params: {
foo: ["bar", null, "baz"]
}
queryParams: [
"foo=bar",
"foo",
"foo=baz"
]

}
])
1 change: 1 addition & 0 deletions modules/protocol-tests/resources/META-INF/smithy/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Pizza.smithy
RoundTrip.smithy
Version.smithy
HttpPayloadWithDefault.smithy
SparseQueryParameter.smithy
test-config.json

0 comments on commit 115e47a

Please sign in to comment.