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

Fix issues with RPCv2 CBOR protocol tests #2246

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
28 changes: 21 additions & 7 deletions smithy-protocol-tests/model/rpcv2Cbor/cbor-lists.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ apply RpcV2CborLists @httpRequestTests([
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
params: {
"stringList": [
"foo",
Expand Down Expand Up @@ -114,9 +116,11 @@ apply RpcV2CborLists @httpRequestTests([
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
params: {
stringList: []
}
Expand All @@ -132,9 +136,11 @@ apply RpcV2CborLists @httpRequestTests([
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
params: {
stringList: []
}
Expand All @@ -149,9 +155,11 @@ apply RpcV2CborLists @httpRequestTests([
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
params: {
stringList: ["An example indefinite string, which will be chunked, on each comma", "Another example indefinite string with only one chunk", "This is a plain string"]
}
Expand All @@ -167,9 +175,11 @@ apply RpcV2CborLists @httpRequestTests([
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
params: {
stringList: ["An example indefinite string, which will be chunked, on each comma", "Another example indefinite string with only one chunk", "This is a plain string"]
},
Expand Down Expand Up @@ -333,9 +343,11 @@ structure StructureListMember {
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
body: "v29zcGFyc2VTdHJpbmdNYXC/Y2Zvb/b//w=="
params: {
"sparseStringMap": {
Expand All @@ -352,9 +364,11 @@ structure StructureListMember {
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
body: "v3BzcGFyc2VTdHJpbmdMaXN0n/b//w=="
params: {
"sparseStringList": [
Expand Down
32 changes: 24 additions & 8 deletions smithy-protocol-tests/model/rpcv2Cbor/cbor-maps.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ apply RpcV2CborDenseMaps @httpRequestTests([
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
params: {
"denseStructMap": {
"foo": {
Expand All @@ -53,9 +55,11 @@ apply RpcV2CborDenseMaps @httpRequestTests([
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
params: {
"denseNumberMap": {
"x": 0
Expand All @@ -75,9 +79,11 @@ apply RpcV2CborDenseMaps @httpRequestTests([
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
params: {
"denseSetMap": {
"x": [],
Expand Down Expand Up @@ -217,9 +223,11 @@ apply RpcV2CborSparseMaps @httpRequestTests([
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
params: {
"sparseStructMap": {
"foo": {
Expand All @@ -241,9 +249,11 @@ apply RpcV2CborSparseMaps @httpRequestTests([
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
params: {
"sparseBooleanMap": {
"x": null
Expand All @@ -269,9 +279,11 @@ apply RpcV2CborSparseMaps @httpRequestTests([
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
params: {
"sparseSetMap": {
"x": [],
Expand All @@ -289,9 +301,11 @@ apply RpcV2CborSparseMaps @httpRequestTests([
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
params: {
"sparseSetMap": {
"x": [],
Expand All @@ -310,9 +324,11 @@ apply RpcV2CborSparseMaps @httpRequestTests([
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
params: {
"sparseNumberMap": {
"x": 0
Expand Down
48 changes: 36 additions & 12 deletions smithy-protocol-tests/model/rpcv2Cbor/cbor-structs.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ use smithy.test#httpResponseTests
documentation: "Serializes simple scalar properties",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
}
requireHeaders: [
"Content-Length"
],
method: "POST",
bodyMediaType: "application/cbor",
uri: "/service/RpcV2Protocol/operation/SimpleScalarProperties",
Expand All @@ -42,9 +44,11 @@ use smithy.test#httpResponseTests
a key encoded using an indefinite length string.""",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
}
requireHeaders: [
"Content-Length"
],
method: "POST",
bodyMediaType: "application/cbor",
uri: "/service/RpcV2Protocol/operation/SimpleScalarProperties",
Expand Down Expand Up @@ -73,9 +77,11 @@ use smithy.test#httpResponseTests
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
}
requireHeaders: [
"Content-Length"
],
params: {
stringValue: null
},
Expand All @@ -91,9 +97,11 @@ use smithy.test#httpResponseTests
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
}
requireHeaders: [
"Content-Length"
],
params: {},
appliesTo: "server"
},
Expand All @@ -103,9 +111,11 @@ use smithy.test#httpResponseTests
documentation: "Supports handling NaN float values.",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
}
requireHeaders: [
"Content-Length"
],
method: "POST",
bodyMediaType: "application/cbor",
uri: "/service/RpcV2Protocol/operation/SimpleScalarProperties",
Expand All @@ -121,9 +131,11 @@ use smithy.test#httpResponseTests
documentation: "Supports handling Infinity float values.",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
}
requireHeaders: [
"Content-Length"
],
method: "POST",
bodyMediaType: "application/cbor",
uri: "/service/RpcV2Protocol/operation/SimpleScalarProperties",
Expand All @@ -139,9 +151,11 @@ use smithy.test#httpResponseTests
documentation: "Supports handling Infinity float values.",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
}
requireHeaders: [
"Content-Length"
],
method: "POST",
bodyMediaType: "application/cbor",
uri: "/service/RpcV2Protocol/operation/SimpleScalarProperties",
Expand All @@ -157,9 +171,11 @@ use smithy.test#httpResponseTests
documentation: "The server should be capable of deserializing indefinite length text strings.",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
}
requireHeaders: [
"Content-Length"
],
method: "POST",
bodyMediaType: "application/cbor",
uri: "/service/RpcV2Protocol/operation/SimpleScalarProperties",
Expand All @@ -175,9 +191,11 @@ use smithy.test#httpResponseTests
documentation: "The server should be capable of deserializing indefinite length byte strings.",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
}
requireHeaders: [
"Content-Length"
],
method: "POST",
bodyMediaType: "application/cbor",
uri: "/service/RpcV2Protocol/operation/SimpleScalarProperties",
Expand All @@ -193,9 +211,11 @@ use smithy.test#httpResponseTests
documentation: "Supports upcasting from a smaller byte representation of the same data type.",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
}
requireHeaders: [
"Content-Length"
],
method: "POST",
bodyMediaType: "application/cbor",
uri: "/service/RpcV2Protocol/operation/SimpleScalarProperties",
Expand All @@ -218,9 +238,11 @@ use smithy.test#httpResponseTests
generated against an older Smithy model.""",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
}
requireHeaders: [
"Content-Length"
],
method: "POST",
bodyMediaType: "application/cbor",
uri: "/service/RpcV2Protocol/operation/SimpleScalarProperties",
Expand Down Expand Up @@ -431,9 +453,11 @@ apply RecursiveShapes @httpRequestTests([
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
requireHeaders: [
"Content-Length"
],
params: {
nested: {
foo: "Foo1",
Expand Down
Loading
Loading