Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compliance test for sparse query parameters #172

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading