Skip to content

Commit d19fa75

Browse files
committed
Add query-compatible protocol tests
skip some protoocl tests and update to latest smithy version fix protocol test. return if reader.IsFinalBlock is true for empty responses add DevConfig Remove LaunchSettings.json
1 parent f25543e commit d19fa75

File tree

255 files changed

+4857
-398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+4857
-398
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"core": {
3+
"updateMinimum": true,
4+
"type": "patch",
5+
"changeLogMessages": [
6+
"Add new protocol tests. Update response unmarshallers to returis an empty response"
7+
]
8+
}
9+
}

generator/ProtocolTestsGenerator/settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pluginManagement {
1212
dependencyResolutionManagement {
1313
versionCatalogs {
1414
create("codegen") {
15-
version("smithy", "1.54.0")
15+
version("smithy", "1.60.2")
1616
library("protocol-tests", "software.amazon.smithy", "smithy-aws-protocol-tests").versionRef("smithy")
1717
library("codegen-core", "software.amazon.smithy", "smithy-codegen-core").versionRef("smithy")
1818
library("protocol-tests-traits", "software.amazon.smithy", "smithy-protocol-test-traits").versionRef("smithy")

generator/ProtocolTestsGenerator/smithy-dotnet-codegen/src/main/java/software/amazon/smithy/dotnet/codegen/HttpProtocolTestGenerator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ private void generateErrorResponseTests(OperationShape operation, OperationIndex
9494
for (StructureShape error : index.getErrors(operation, service)) {
9595
error.getTrait(HttpResponseTestsTrait.class).ifPresent(trait -> {
9696
for (HttpResponseTestCase httpResponseTestCase : trait.getTestCasesFor(AppliesTo.CLIENT)) {
97-
generateErrorResponseTest(operation, error, httpResponseTestCase);
97+
if (!ProtocolTestCustomizations.TestsToSkip.contains(httpResponseTestCase.getId())){
98+
generateErrorResponseTest(operation, error, httpResponseTestCase);
99+
}
98100
}
99101
});
100102
}

generator/ProtocolTestsGenerator/smithy-dotnet-codegen/src/main/java/software/amazon/smithy/dotnet/codegen/customizations/ProtocolTestCustomizations.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ private ProtocolTestCustomizations() {
9696
// to use exceptions and control flow.
9797
"QueryEmptyInputAndEmptyOutput",
9898
"QueryNoInputAndNoOutput",
99-
"QueryNoInputAndOutput"
99+
"QueryNoInputAndOutput",
100+
// this test is skipped because in the C2J Ruby added a hook which adds the "code" json key which can NEVER exist in a
101+
// non-query protocol. this causes our code generation to check on this code instead of what is modeled and our protocol
102+
// test passes. As this can never happen in a real service, we can skip this to avoid unnecessary customizations in the generator
103+
// for a scenario that will never happen.
104+
"QueryCompatibleAwsJson10CustomCodeError"
100105
);
101106
public static final List<String> VNextTests = Arrays.asList(
102107
//These are the tests that are failing in v4 after updating to 1.54.0 and artifacts 1.0.3004.0. Each one needs to be investigated.

generator/ProtocolTestsGenerator/smithy-dotnet-protocol-test/smithy-build.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,24 @@
127127
"packageVersion": "0.0.1"
128128
}
129129
}
130+
},
131+
"QueryCompatibleJSONRPC10": {
132+
"transforms": [
133+
{
134+
"name": "includeServices",
135+
"args": {
136+
"services": [
137+
"aws.protocoltests.json10#QueryCompatibleJsonRpc10"
138+
]
139+
}
140+
}
141+
],
142+
"plugins": {
143+
"dotnet-protocol-test-codegen": {
144+
"service": "aws.protocoltests.json10#QueryCompatibleJsonRpc10",
145+
"packageVersion": "0.0.1"
146+
}
147+
}
130148
}
131149
}
132150
}

generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCResponseUnmarshaller.cs

Lines changed: 31 additions & 30 deletions
Large diffs are not rendered by default.

generator/ServiceClientGeneratorLib/Generators/Marshallers/JsonRPCResponseUnmarshaller.tt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
9191
{
9292
#>
9393
StreamingUtf8JsonReader reader = new StreamingUtf8JsonReader(context.Stream);
94+
if (reader.Reader.IsFinalBlock) return response;
9495
var unmarshaller = <#= payload.DetermineTypeUnmarshallerInstantiate() #>;
9596
response.<#=payload.PropertyName#> = unmarshaller.Unmarshall(context, ref reader);
9697
<#

generator/TestServiceModels/json10-tests-client/json-rpc-10-2020-07-14.normal.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@
114114
"input":{"shape":"PutWithContentEncodingInput"},
115115
"requestcompression":{"encodings":["gzip"]}
116116
},
117+
"QueryIncompatibleOperation":{
118+
"name":"QueryIncompatibleOperation",
119+
"http":{
120+
"method":"POST",
121+
"requestUri":"/"
122+
},
123+
"idempotent":true
124+
},
117125
"SimpleScalarProperties":{
118126
"name":"SimpleScalarProperties",
119127
"http":{
@@ -153,22 +161,19 @@
153161
},
154162
"ContentTypeParametersOutput":{
155163
"type":"structure",
156-
"members":{
157-
}
164+
"members":{}
158165
},
159166
"Double":{
160167
"type":"double",
161168
"box":true
162169
},
163170
"EmptyInputAndEmptyOutputInput":{
164171
"type":"structure",
165-
"members":{
166-
}
172+
"members":{}
167173
},
168174
"EmptyInputAndEmptyOutputOutput":{
169175
"type":"structure",
170-
"members":{
171-
}
176+
"members":{}
172177
},
173178
"EndpointWithHostLabelOperationInput":{
174179
"type":"structure",
@@ -196,8 +201,7 @@
196201
},
197202
"FooError":{
198203
"type":"structure",
199-
"members":{
200-
},
204+
"members":{},
201205
"documentation":"<p>This error has test cases that test some of the dark corners of Amazon service framework history. It should only be implemented by clients.</p>",
202206
"exception":true,
203207
"fault":true
@@ -267,8 +271,7 @@
267271
},
268272
"NoInputAndOutputOutput":{
269273
"type":"structure",
270-
"members":{
271-
}
274+
"members":{}
272275
},
273276
"PutWithContentEncodingInput":{
274277
"type":"structure",

generator/TestServiceModels/json11-tests-client/json-protocol-2018-01-01.normal.json

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@
211211
},
212212
"ContentTypeParametersOutput":{
213213
"type":"structure",
214-
"members":{
215-
}
214+
"members":{}
216215
},
217216
"DateTime":{
218217
"type":"timestamp",
@@ -226,8 +225,7 @@
226225
},
227226
"Document":{
228227
"type":"structure",
229-
"members":{
230-
},
228+
"members":{},
231229
"document":true
232230
},
233231
"Double":{
@@ -236,8 +234,7 @@
236234
},
237235
"EmptyStruct":{
238236
"type":"structure",
239-
"members":{
240-
}
237+
"members":{}
241238
},
242239
"ErrorWithMembers":{
243240
"type":"structure",
@@ -257,8 +254,7 @@
257254
},
258255
"ErrorWithoutMembers":{
259256
"type":"structure",
260-
"members":{
261-
},
257+
"members":{},
262258
"exception":true,
263259
"fault":true
264260
},
@@ -291,8 +287,7 @@
291287
},
292288
"FooError":{
293289
"type":"structure",
294-
"members":{
295-
},
290+
"members":{},
296291
"documentation":"<p>This error has test cases that test some of the dark corners of Amazon service framework history. It should only be implemented by clients.</p>",
297292
"exception":true,
298293
"fault":true
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"active": true,
3+
"test-service": true,
4+
"synopsis": "query-compatible test service"
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"version":"2.0",
3+
"metadata":{
4+
"apiVersion":"2020-07-14",
5+
"auth":["aws.auth#sigv4"],
6+
"awsQueryCompatible":{},
7+
"endpointPrefix":"query-compatible-jsonrpc10",
8+
"jsonVersion":"1.0",
9+
"protocol":"json",
10+
"protocols":["json"],
11+
"serviceFullName":"Query Compatible Json 1.0 Protocol Service",
12+
"serviceId":"Query Compatible JSON RPC 10",
13+
"signatureVersion":"v4",
14+
"signingName":"query-compatible-jsonrpc10",
15+
"targetPrefix":"QueryCompatibleJsonRpc10",
16+
"uid":"query-compatible-json-rpc-10-2020-07-14"
17+
},
18+
"operations":{
19+
"QueryCompatibleOperation":{
20+
"name":"QueryCompatibleOperation",
21+
"http":{
22+
"method":"POST",
23+
"requestUri":"/"
24+
},
25+
"errors":[
26+
{"shape":"CustomCodeError"},
27+
{"shape":"NoCustomCodeError"}
28+
],
29+
"idempotent":true
30+
}
31+
},
32+
"shapes":{
33+
"CustomCodeError":{
34+
"type":"structure",
35+
"members":{
36+
"message":{"shape":"String"}
37+
},
38+
"error":{
39+
"code":"Customized",
40+
"httpStatusCode":402,
41+
"senderFault":true
42+
},
43+
"exception":true
44+
},
45+
"NoCustomCodeError":{
46+
"type":"structure",
47+
"members":{
48+
"message":{"shape":"String"}
49+
},
50+
"exception":true
51+
},
52+
"String":{"type":"string"}
53+
}
54+
}

generator/TestServiceModels/restjson-tests-client/rest-json-protocol-2019-12-16.normal.json

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,17 @@
176176
"documentation":"<p>This example tests httpChecksumRequired trait</p>",
177177
"httpChecksumRequired":true
178178
},
179+
"HttpEmptyPrefixHeaders":{
180+
"name":"HttpEmptyPrefixHeaders",
181+
"http":{
182+
"method":"GET",
183+
"requestUri":"/HttpEmptyPrefixHeaders",
184+
"responseCode":200
185+
},
186+
"input":{"shape":"HttpEmptyPrefixHeadersInput"},
187+
"output":{"shape":"HttpEmptyPrefixHeadersOutput"},
188+
"documentation":"<p>Clients that perform this test extract all headers from the response.</p>"
189+
},
179190
"HttpEnumPayload":{
180191
"name":"HttpEnumPayload",
181192
"http":{
@@ -854,8 +865,7 @@
854865
},
855866
"ContentTypeParametersOutput":{
856867
"type":"structure",
857-
"members":{
858-
}
868+
"members":{}
859869
},
860870
"DateTime":{
861871
"type":"timestamp",
@@ -894,8 +904,7 @@
894904
},
895905
"Document":{
896906
"type":"structure",
897-
"members":{
898-
},
907+
"members":{},
899908
"document":true
900909
},
901910
"DocumentTypeAsMapValueInputOutput":{
@@ -933,13 +942,11 @@
933942
},
934943
"EmptyInputAndEmptyOutputInput":{
935944
"type":"structure",
936-
"members":{
937-
}
945+
"members":{}
938946
},
939947
"EmptyInputAndEmptyOutputOutput":{
940948
"type":"structure",
941-
"members":{
942-
}
949+
"members":{}
943950
},
944951
"EnumPayloadInput":{
945952
"type":"structure",
@@ -981,8 +988,7 @@
981988
},
982989
"FooError":{
983990
"type":"structure",
984-
"members":{
985-
},
991+
"members":{},
986992
"documentation":"<p>This error has test cases that test some of the dark corners of Amazon service framework history. It should only be implemented by clients.</p>",
987993
"error":{"httpStatusCode":500},
988994
"exception":true,
@@ -1030,6 +1036,36 @@
10301036
"type":"timestamp",
10311037
"timestampFormat":"rfc822"
10321038
},
1039+
"HttpEmptyPrefixHeadersInput":{
1040+
"type":"structure",
1041+
"members":{
1042+
"prefixHeaders":{
1043+
"shape":"StringMap",
1044+
"location":"headers",
1045+
"locationName":""
1046+
},
1047+
"specificHeader":{
1048+
"shape":"String",
1049+
"location":"header",
1050+
"locationName":"hello"
1051+
}
1052+
}
1053+
},
1054+
"HttpEmptyPrefixHeadersOutput":{
1055+
"type":"structure",
1056+
"members":{
1057+
"prefixHeaders":{
1058+
"shape":"StringMap",
1059+
"location":"headers",
1060+
"locationName":""
1061+
},
1062+
"specificHeader":{
1063+
"shape":"String",
1064+
"location":"header",
1065+
"locationName":"hello"
1066+
}
1067+
}
1068+
},
10331069
"HttpPayloadTraitsInputOutput":{
10341070
"type":"structure",
10351071
"members":{
@@ -1058,8 +1094,7 @@
10581094
},
10591095
"HttpPrefixHeadersInResponseInput":{
10601096
"type":"structure",
1061-
"members":{
1062-
}
1097+
"members":{}
10631098
},
10641099
"HttpPrefixHeadersInResponseOutput":{
10651100
"type":"structure",
@@ -1536,8 +1571,7 @@
15361571
},
15371572
"NoInputAndOutputOutput":{
15381573
"type":"structure",
1539-
"members":{
1540-
}
1574+
"members":{}
15411575
},
15421576
"NullAndEmptyHeadersIO":{
15431577
"type":"structure",
@@ -1711,8 +1745,7 @@
17111745
},
17121746
"ResponseCodeHttpFallbackInputOutput":{
17131747
"type":"structure",
1714-
"members":{
1715-
}
1748+
"members":{}
17161749
},
17171750
"ResponseCodeRequiredOutput":{
17181751
"type":"structure",

0 commit comments

Comments
 (0)