Skip to content

Commit a3e3927

Browse files
Strict union regeneration (#2772)
* chore(codegen): re-enable union and body protocol tests * chore(codegen): regenerate with strict union parsing
1 parent dcf644f commit a3e3927

File tree

31 files changed

+338
-320
lines changed

31 files changed

+338
-320
lines changed

Diff for: clients/client-accessanalyzer/protocols/Aws_restJson1.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ import {
116116
expectNonNull as __expectNonNull,
117117
expectObject as __expectObject,
118118
expectString as __expectString,
119+
expectUnion as __expectUnion,
119120
extendedEncodeURIComponent as __extendedEncodeURIComponent,
120121
parseRfc3339DateTime as __parseRfc3339DateTime,
121122
strictParseInt32 as __strictParseInt32,
@@ -4336,7 +4337,7 @@ const deserializeAws_restJson1ConfigurationsMap = (
43364337
}
43374338
return {
43384339
...acc,
4339-
[key]: deserializeAws_restJson1Configuration(value, context),
4340+
[key]: deserializeAws_restJson1Configuration(__expectUnion(value), context),
43404341
};
43414342
}, {});
43424343
};
@@ -4730,7 +4731,7 @@ const deserializeAws_restJson1PathElementList = (output: any, context: __SerdeCo
47304731
if (entry === null) {
47314732
return null as any;
47324733
}
4733-
return deserializeAws_restJson1PathElement(entry, context);
4734+
return deserializeAws_restJson1PathElement(__expectUnion(entry), context);
47344735
});
47354736
};
47364737

@@ -4800,7 +4801,7 @@ const deserializeAws_restJson1S3AccessPointConfiguration = (
48004801
accessPointPolicy: __expectString(output.accessPointPolicy),
48014802
networkOrigin:
48024803
output.networkOrigin !== undefined && output.networkOrigin !== null
4803-
? deserializeAws_restJson1NetworkOriginConfiguration(output.networkOrigin, context)
4804+
? deserializeAws_restJson1NetworkOriginConfiguration(__expectUnion(output.networkOrigin), context)
48044805
: undefined,
48054806
publicAccessBlock:
48064807
output.publicAccessBlock !== undefined && output.publicAccessBlock !== null
@@ -4834,7 +4835,7 @@ const deserializeAws_restJson1S3BucketAclGrantConfiguration = (
48344835
return {
48354836
grantee:
48364837
output.grantee !== undefined && output.grantee !== null
4837-
? deserializeAws_restJson1AclGrantee(output.grantee, context)
4838+
? deserializeAws_restJson1AclGrantee(__expectUnion(output.grantee), context)
48384839
: undefined,
48394840
permission: __expectString(output.permission),
48404841
} as any;

Diff for: clients/client-app-mesh/protocols/Aws_restJson1.ts

+49-48
Large diffs are not rendered by default.

Diff for: clients/client-clouddirectory/protocols/Aws_restJson1.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ import {
282282
expectNumber as __expectNumber,
283283
expectObject as __expectObject,
284284
expectString as __expectString,
285+
expectUnion as __expectUnion,
285286
parseEpochTimestamp as __parseEpochTimestamp,
286287
} from "@aws-sdk/smithy-client";
287288
import {
@@ -11841,7 +11842,7 @@ const deserializeAws_restJson1AttributeKeyAndValue = (output: any, context: __Se
1184111842
: undefined,
1184211843
Value:
1184311844
output.Value !== undefined && output.Value !== null
11844-
? deserializeAws_restJson1TypedAttributeValue(output.Value, context)
11845+
? deserializeAws_restJson1TypedAttributeValue(__expectUnion(output.Value), context)
1184511846
: undefined,
1184611847
} as any;
1184711848
};
@@ -11865,7 +11866,7 @@ const deserializeAws_restJson1AttributeNameAndValue = (output: any, context: __S
1186511866
AttributeName: __expectString(output.AttributeName),
1186611867
Value:
1186711868
output.Value !== undefined && output.Value !== null
11868-
? deserializeAws_restJson1TypedAttributeValue(output.Value, context)
11869+
? deserializeAws_restJson1TypedAttributeValue(__expectUnion(output.Value), context)
1186911870
: undefined,
1187011871
} as any;
1187111872
};
@@ -12435,7 +12436,7 @@ const deserializeAws_restJson1FacetAttributeDefinition = (
1243512436
return {
1243612437
DefaultValue:
1243712438
output.DefaultValue !== undefined && output.DefaultValue !== null
12438-
? deserializeAws_restJson1TypedAttributeValue(output.DefaultValue, context)
12439+
? deserializeAws_restJson1TypedAttributeValue(__expectUnion(output.DefaultValue), context)
1243912440
: undefined,
1244012441
IsImmutable: __expectBoolean(output.IsImmutable),
1244112442
Rules:
@@ -12737,7 +12738,7 @@ const deserializeAws_restJson1TypedLinkAttributeDefinition = (
1273712738
return {
1273812739
DefaultValue:
1273912740
output.DefaultValue !== undefined && output.DefaultValue !== null
12740-
? deserializeAws_restJson1TypedAttributeValue(output.DefaultValue, context)
12741+
? deserializeAws_restJson1TypedAttributeValue(__expectUnion(output.DefaultValue), context)
1274112742
: undefined,
1274212743
IsImmutable: __expectBoolean(output.IsImmutable),
1274312744
Name: __expectString(output.Name),

Diff for: clients/client-cloudfront/protocols/Aws_restXml.ts

+66-66
Large diffs are not rendered by default.

Diff for: clients/client-codeguruprofiler/protocols/Aws_restJson1.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ export const deserializeAws_restJson1ConfigureAgentCommand = async (
11401140
$metadata: deserializeMetadata(output),
11411141
configuration: undefined,
11421142
};
1143-
const data: object | undefined = __expectObject(await parseBody(output.body, context));
1143+
const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context));
11441144
contents.configuration = deserializeAws_restJson1AgentConfiguration(data, context);
11451145
return Promise.resolve(contents);
11461146
};
@@ -1217,7 +1217,7 @@ export const deserializeAws_restJson1CreateProfilingGroupCommand = async (
12171217
$metadata: deserializeMetadata(output),
12181218
profilingGroup: undefined,
12191219
};
1220-
const data: object | undefined = __expectObject(await parseBody(output.body, context));
1220+
const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context));
12211221
contents.profilingGroup = deserializeAws_restJson1ProfilingGroupDescription(data, context);
12221222
return Promise.resolve(contents);
12231223
};
@@ -1385,7 +1385,7 @@ export const deserializeAws_restJson1DescribeProfilingGroupCommand = async (
13851385
$metadata: deserializeMetadata(output),
13861386
profilingGroup: undefined,
13871387
};
1388-
const data: object | undefined = __expectObject(await parseBody(output.body, context));
1388+
const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context));
13891389
contents.profilingGroup = deserializeAws_restJson1ProfilingGroupDescription(data, context);
13901390
return Promise.resolve(contents);
13911391
};
@@ -2733,7 +2733,7 @@ export const deserializeAws_restJson1UpdateProfilingGroupCommand = async (
27332733
$metadata: deserializeMetadata(output),
27342734
profilingGroup: undefined,
27352735
};
2736-
const data: object | undefined = __expectObject(await parseBody(output.body, context));
2736+
const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context));
27372737
contents.profilingGroup = deserializeAws_restJson1ProfilingGroupDescription(data, context);
27382738
return Promise.resolve(contents);
27392739
};

Diff for: clients/client-dynamodb-streams/protocols/Aws_json1_0.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
expectNonNull as __expectNonNull,
3434
expectNumber as __expectNumber,
3535
expectString as __expectString,
36+
expectUnion as __expectUnion,
3637
parseEpochTimestamp as __parseEpochTimestamp,
3738
} from "@aws-sdk/smithy-client";
3839
import {
@@ -497,7 +498,7 @@ const deserializeAws_json1_0AttributeMap = (
497498
}
498499
return {
499500
...acc,
500-
[key]: deserializeAws_json1_0AttributeValue(value, context),
501+
[key]: deserializeAws_json1_0AttributeValue(__expectUnion(value), context),
501502
};
502503
}, {});
503504
};
@@ -637,7 +638,7 @@ const deserializeAws_json1_0ListAttributeValue = (output: any, context: __SerdeC
637638
if (entry === null) {
638639
return null as any;
639640
}
640-
return deserializeAws_json1_0AttributeValue(entry, context);
641+
return deserializeAws_json1_0AttributeValue(__expectUnion(entry), context);
641642
});
642643
};
643644

@@ -661,7 +662,7 @@ const deserializeAws_json1_0MapAttributeValue = (
661662
}
662663
return {
663664
...acc,
664-
[key]: deserializeAws_json1_0AttributeValue(value, context),
665+
[key]: deserializeAws_json1_0AttributeValue(__expectUnion(value), context),
665666
};
666667
}, {});
667668
};

Diff for: clients/client-dynamodb/protocols/Aws_json1_0.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ import {
329329
expectNonNull as __expectNonNull,
330330
expectNumber as __expectNumber,
331331
expectString as __expectString,
332+
expectUnion as __expectUnion,
332333
limitedParseDouble as __limitedParseDouble,
333334
parseEpochTimestamp as __parseEpochTimestamp,
334335
serializeFloat as __serializeFloat,
@@ -7601,7 +7602,7 @@ const deserializeAws_json1_0AttributeMap = (
76017602
}
76027603
return {
76037604
...acc,
7604-
[key]: deserializeAws_json1_0AttributeValue(value, context),
7605+
[key]: deserializeAws_json1_0AttributeValue(__expectUnion(value), context),
76057606
};
76067607
}, {});
76077608
};
@@ -8635,7 +8636,7 @@ const deserializeAws_json1_0ItemCollectionKeyAttributeMap = (
86358636
}
86368637
return {
86378638
...acc,
8638-
[key]: deserializeAws_json1_0AttributeValue(value, context),
8639+
[key]: deserializeAws_json1_0AttributeValue(__expectUnion(value), context),
86398640
};
86408641
}, {});
86418642
};
@@ -8743,7 +8744,7 @@ const deserializeAws_json1_0Key = (output: any, context: __SerdeContext): { [key
87438744
}
87448745
return {
87458746
...acc,
8746-
[key]: deserializeAws_json1_0AttributeValue(value, context),
8747+
[key]: deserializeAws_json1_0AttributeValue(__expectUnion(value), context),
87478748
};
87488749
}, {});
87498750
};
@@ -8845,7 +8846,7 @@ const deserializeAws_json1_0ListAttributeValue = (output: any, context: __SerdeC
88458846
if (entry === null) {
88468847
return null as any;
88478848
}
8848-
return deserializeAws_json1_0AttributeValue(entry, context);
8849+
return deserializeAws_json1_0AttributeValue(__expectUnion(entry), context);
88498850
});
88508851
};
88518852

@@ -8990,7 +8991,7 @@ const deserializeAws_json1_0MapAttributeValue = (
89908991
}
89918992
return {
89928993
...acc,
8993-
[key]: deserializeAws_json1_0AttributeValue(value, context),
8994+
[key]: deserializeAws_json1_0AttributeValue(__expectUnion(value), context),
89948995
};
89958996
}, {});
89968997
};
@@ -9118,7 +9119,7 @@ const deserializeAws_json1_0PutItemInputAttributeMap = (
91189119
}
91199120
return {
91209121
...acc,
9121-
[key]: deserializeAws_json1_0AttributeValue(value, context),
9122+
[key]: deserializeAws_json1_0AttributeValue(__expectUnion(value), context),
91229123
};
91239124
}, {});
91249125
};

Diff for: clients/client-emr-containers/protocols/Aws_restJson1.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ import {
6464
expectNumber as __expectNumber,
6565
expectObject as __expectObject,
6666
expectString as __expectString,
67+
expectUnion as __expectUnion,
6768
extendedEncodeURIComponent as __extendedEncodeURIComponent,
6869
parseEpochTimestamp as __parseEpochTimestamp,
6970
} from "@aws-sdk/smithy-client";
@@ -1964,7 +1965,7 @@ const deserializeAws_restJson1ContainerProvider = (output: any, context: __Serde
19641965
id: __expectString(output.id),
19651966
info:
19661967
output.info !== undefined && output.info !== null
1967-
? deserializeAws_restJson1ContainerInfo(output.info, context)
1968+
? deserializeAws_restJson1ContainerInfo(__expectUnion(output.info), context)
19681969
: undefined,
19691970
type: __expectString(output.type),
19701971
} as any;

Diff for: clients/client-glacier/protocols/Aws_restJson1.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2755,7 +2755,7 @@ export const deserializeAws_restJson1GetVaultAccessPolicyCommand = async (
27552755
$metadata: deserializeMetadata(output),
27562756
policy: undefined,
27572757
};
2758-
const data: object | undefined = __expectObject(await parseBody(output.body, context));
2758+
const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context));
27592759
contents.policy = deserializeAws_restJson1VaultAccessPolicy(data, context);
27602760
return Promise.resolve(contents);
27612761
};
@@ -2923,7 +2923,7 @@ export const deserializeAws_restJson1GetVaultNotificationsCommand = async (
29232923
$metadata: deserializeMetadata(output),
29242924
vaultNotificationConfig: undefined,
29252925
};
2926-
const data: object | undefined = __expectObject(await parseBody(output.body, context));
2926+
const data: { [key: string]: any } | undefined = __expectObject(await parseBody(output.body, context));
29272927
contents.vaultNotificationConfig = deserializeAws_restJson1VaultNotificationConfig(data, context);
29282928
return Promise.resolve(contents);
29292929
};

Diff for: clients/client-groundstation/protocols/Aws_restJson1.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ import {
9797
expectNumber as __expectNumber,
9898
expectObject as __expectObject,
9999
expectString as __expectString,
100+
expectUnion as __expectUnion,
100101
extendedEncodeURIComponent as __extendedEncodeURIComponent,
101102
limitedParseDouble as __limitedParseDouble,
102103
parseEpochTimestamp as __parseEpochTimestamp,
@@ -1559,7 +1560,7 @@ export const deserializeAws_restJson1GetConfigCommand = async (
15591560
contents.configArn = __expectString(data.configArn);
15601561
}
15611562
if (data.configData !== undefined && data.configData !== null) {
1562-
contents.configData = deserializeAws_restJson1ConfigTypeData(data.configData, context);
1563+
contents.configData = deserializeAws_restJson1ConfigTypeData(__expectUnion(data.configData), context);
15631564
}
15641565
if (data.configId !== undefined && data.configId !== null) {
15651566
contents.configId = __expectString(data.configId);
@@ -3507,7 +3508,7 @@ const deserializeAws_restJson1Destination = (output: any, context: __SerdeContex
35073508
return {
35083509
configDetails:
35093510
output.configDetails !== undefined && output.configDetails !== null
3510-
? deserializeAws_restJson1ConfigDetails(output.configDetails, context)
3511+
? deserializeAws_restJson1ConfigDetails(__expectUnion(output.configDetails), context)
35113512
: undefined,
35123513
configId: __expectString(output.configId),
35133514
configType: __expectString(output.configType),
@@ -3694,7 +3695,7 @@ const deserializeAws_restJson1Source = (output: any, context: __SerdeContext): S
36943695
return {
36953696
configDetails:
36963697
output.configDetails !== undefined && output.configDetails !== null
3697-
? deserializeAws_restJson1ConfigDetails(output.configDetails, context)
3698+
? deserializeAws_restJson1ConfigDetails(__expectUnion(output.configDetails), context)
36983699
: undefined,
36993700
configId: __expectString(output.configId),
37003701
configType: __expectString(output.configType),

Diff for: clients/client-healthlake/protocols/Aws_json1_0.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ import {
7979
expectNonNull as __expectNonNull,
8080
expectNumber as __expectNumber,
8181
expectString as __expectString,
82+
expectUnion as __expectUnion,
8283
parseEpochTimestamp as __parseEpochTimestamp,
8384
} from "@aws-sdk/smithy-client";
8485
import {
@@ -1728,7 +1729,7 @@ const deserializeAws_json1_0ExportJobProperties = (output: any, context: __Serde
17281729
Message: __expectString(output.Message),
17291730
OutputDataConfig:
17301731
output.OutputDataConfig !== undefined && output.OutputDataConfig !== null
1731-
? deserializeAws_json1_0OutputDataConfig(output.OutputDataConfig, context)
1732+
? deserializeAws_json1_0OutputDataConfig(__expectUnion(output.OutputDataConfig), context)
17321733
: undefined,
17331734
SubmitTime:
17341735
output.SubmitTime !== undefined && output.SubmitTime !== null
@@ -1758,13 +1759,13 @@ const deserializeAws_json1_0ImportJobProperties = (output: any, context: __Serde
17581759
: undefined,
17591760
InputDataConfig:
17601761
output.InputDataConfig !== undefined && output.InputDataConfig !== null
1761-
? deserializeAws_json1_0InputDataConfig(output.InputDataConfig, context)
1762+
? deserializeAws_json1_0InputDataConfig(__expectUnion(output.InputDataConfig), context)
17621763
: undefined,
17631764
JobId: __expectString(output.JobId),
17641765
JobName: __expectString(output.JobName),
17651766
JobOutputDataConfig:
17661767
output.JobOutputDataConfig !== undefined && output.JobOutputDataConfig !== null
1767-
? deserializeAws_json1_0OutputDataConfig(output.JobOutputDataConfig, context)
1768+
? deserializeAws_json1_0OutputDataConfig(__expectUnion(output.JobOutputDataConfig), context)
17681769
: undefined,
17691770
JobStatus: __expectString(output.JobStatus),
17701771
Message: __expectString(output.Message),

Diff for: clients/client-iot/protocols/Aws_restJson1.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@ import {
868868
expectNumber as __expectNumber,
869869
expectObject as __expectObject,
870870
expectString as __expectString,
871+
expectUnion as __expectUnion,
871872
extendedEncodeURIComponent as __extendedEncodeURIComponent,
872873
limitedParseDouble as __limitedParseDouble,
873874
parseEpochTimestamp as __parseEpochTimestamp,
@@ -32585,7 +32586,7 @@ const deserializeAws_restJson1AssetPropertyValue = (output: any, context: __Serd
3258532586
: undefined,
3258632587
value:
3258732588
output.value !== undefined && output.value !== null
32588-
? deserializeAws_restJson1AssetPropertyVariant(output.value, context)
32589+
? deserializeAws_restJson1AssetPropertyVariant(__expectUnion(output.value), context)
3258932590
: undefined,
3259032591
} as any;
3259132592
};

Diff for: clients/client-iotanalytics/protocols/Aws_restJson1.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ import {
152152
expectNumber as __expectNumber,
153153
expectObject as __expectObject,
154154
expectString as __expectString,
155+
expectUnion as __expectUnion,
155156
extendedEncodeURIComponent as __extendedEncodeURIComponent,
156157
limitedParseDouble as __limitedParseDouble,
157158
parseEpochTimestamp as __parseEpochTimestamp,
@@ -5659,7 +5660,7 @@ const deserializeAws_restJson1Datastore = (output: any, context: __SerdeContext)
56595660
status: __expectString(output.status),
56605661
storage:
56615662
output.storage !== undefined && output.storage !== null
5662-
? deserializeAws_restJson1DatastoreStorage(output.storage, context)
5663+
? deserializeAws_restJson1DatastoreStorage(__expectUnion(output.storage), context)
56635664
: undefined,
56645665
} as any;
56655666
};

Diff for: clients/client-kendra/protocols/Aws_json1_1.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ import {
290290
expectNonNull as __expectNonNull,
291291
expectNumber as __expectNumber,
292292
expectString as __expectString,
293+
expectUnion as __expectUnion,
293294
limitedParseFloat32 as __limitedParseFloat32,
294295
parseEpochTimestamp as __parseEpochTimestamp,
295296
serializeFloat as __serializeFloat,
@@ -8133,7 +8134,7 @@ const deserializeAws_json1_1DocumentAttribute = (output: any, context: __SerdeCo
81338134
Key: __expectString(output.Key),
81348135
Value:
81358136
output.Value !== undefined && output.Value !== null
8136-
? deserializeAws_json1_1DocumentAttributeValue(output.Value, context)
8137+
? deserializeAws_json1_1DocumentAttributeValue(__expectUnion(output.Value), context)
81378138
: undefined,
81388139
} as any;
81398140
};
@@ -8188,7 +8189,7 @@ const deserializeAws_json1_1DocumentAttributeValueCountPair = (
81888189
Count: __expectInt32(output.Count),
81898190
DocumentAttributeValue:
81908191
output.DocumentAttributeValue !== undefined && output.DocumentAttributeValue !== null
8191-
? deserializeAws_json1_1DocumentAttributeValue(output.DocumentAttributeValue, context)
8192+
? deserializeAws_json1_1DocumentAttributeValue(__expectUnion(output.DocumentAttributeValue), context)
81928193
: undefined,
81938194
} as any;
81948195
};

0 commit comments

Comments
 (0)