Skip to content

feat: populate contents from '#text' recursively in parseBody #1154

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

Merged
merged 4 commits into from
May 8, 2020
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
851 changes: 172 additions & 679 deletions clients/client-auto-scaling/protocols/Aws_query.ts

Large diffs are not rendered by default.

1,402 changes: 286 additions & 1,116 deletions clients/client-cloudformation/protocols/Aws_query.ts

Large diffs are not rendered by default.

1,482 changes: 292 additions & 1,190 deletions clients/client-cloudfront/protocols/Aws_restXml.ts

Large diffs are not rendered by default.

584 changes: 118 additions & 466 deletions clients/client-cloudsearch/protocols/Aws_query.ts

Large diffs are not rendered by default.

574 changes: 114 additions & 460 deletions clients/client-cloudwatch/protocols/Aws_query.ts

Large diffs are not rendered by default.

996 changes: 201 additions & 795 deletions clients/client-docdb/protocols/Aws_query.ts

Large diffs are not rendered by default.

8,248 changes: 1,645 additions & 6,603 deletions clients/client-ec2/protocols/Aws_ec2.ts

Large diffs are not rendered by default.

1,111 changes: 219 additions & 892 deletions clients/client-elastic-beanstalk/protocols/Aws_query.ts

Large diffs are not rendered by default.

742 changes: 150 additions & 592 deletions clients/client-elastic-load-balancing-v2/protocols/Aws_query.ts

Large diffs are not rendered by default.

430 changes: 87 additions & 343 deletions clients/client-elastic-load-balancing/protocols/Aws_query.ts

Large diffs are not rendered by default.

1,315 changes: 266 additions & 1,049 deletions clients/client-elasticache/protocols/Aws_query.ts

Large diffs are not rendered by default.

1,419 changes: 288 additions & 1,131 deletions clients/client-iam/protocols/Aws_query.ts

Large diffs are not rendered by default.

1,473 changes: 297 additions & 1,176 deletions clients/client-neptune/protocols/Aws_query.ts

Large diffs are not rendered by default.

3,118 changes: 625 additions & 2,493 deletions clients/client-rds/protocols/Aws_query.ts

Large diffs are not rendered by default.

1,973 changes: 400 additions & 1,573 deletions clients/client-redshift/protocols/Aws_query.ts

Large diffs are not rendered by default.

1,123 changes: 225 additions & 898 deletions clients/client-route-53/protocols/Aws_restXml.ts

Large diffs are not rendered by default.

465 changes: 94 additions & 371 deletions clients/client-s3-control/protocols/Aws_restXml.ts

Large diffs are not rendered by default.

1,038 changes: 208 additions & 830 deletions clients/client-s3/protocols/Aws_restXml.ts

Large diffs are not rendered by default.

820 changes: 167 additions & 653 deletions clients/client-ses/protocols/Aws_query.ts

Large diffs are not rendered by default.

254 changes: 53 additions & 201 deletions clients/client-sns/protocols/Aws_query.ts

Large diffs are not rendered by default.

166 changes: 36 additions & 130 deletions clients/client-sqs/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ import {
import {
SmithyException as __SmithyException,
extendedEncodeURIComponent as __extendedEncodeURIComponent,
getArrayIfSingleItem as __getArrayIfSingleItem
getArrayIfSingleItem as __getArrayIfSingleItem,
getValueFromTextNode as __getValueFromTextNode
} from "@aws-sdk/smithy-client";
import {
Endpoint as __Endpoint,
Expand Down Expand Up @@ -2869,28 +2870,16 @@ const deserializeAws_queryBatchResultErrorEntry = (
SenderFault: undefined
};
if (output["Code"] !== undefined) {
contents.Code =
output["Code"]["#text"] !== undefined
? output["Code"]["#text"]
: output["Code"];
contents.Code = output["Code"];
}
if (output["Id"] !== undefined) {
contents.Id =
output["Id"]["#text"] !== undefined
? output["Id"]["#text"]
: output["Id"];
contents.Id = output["Id"];
}
if (output["Message"] !== undefined) {
contents.Message =
output["Message"]["#text"] !== undefined
? output["Message"]["#text"]
: output["Message"];
contents.Message = output["Message"];
}
if (output["SenderFault"] !== undefined) {
contents.SenderFault =
(output["SenderFault"]["#text"] !== undefined
? output["SenderFault"]["#text"]
: output["SenderFault"]) == "true";
contents.SenderFault = output["SenderFault"] == "true";
}
return contents;
};
Expand All @@ -2908,9 +2897,7 @@ const deserializeAws_queryBinaryList = (
output: any,
context: __SerdeContext
): Uint8Array[] => {
return (output || []).map((entry: any) =>
context.base64Decoder(entry["#text"] !== undefined ? entry["#text"] : entry)
);
return (output || []).map((entry: any) => context.base64Decoder(entry));
};

const deserializeAws_queryChangeMessageVisibilityBatchResult = (
Expand Down Expand Up @@ -2952,10 +2939,7 @@ const deserializeAws_queryChangeMessageVisibilityBatchResultEntry = (
Id: undefined
};
if (output["Id"] !== undefined) {
contents.Id =
output["Id"]["#text"] !== undefined
? output["Id"]["#text"]
: output["Id"];
contents.Id = output["Id"];
}
return contents;
};
Expand All @@ -2978,10 +2962,7 @@ const deserializeAws_queryCreateQueueResult = (
QueueUrl: undefined
};
if (output["QueueUrl"] !== undefined) {
contents.QueueUrl =
output["QueueUrl"]["#text"] !== undefined
? output["QueueUrl"]["#text"]
: output["QueueUrl"];
contents.QueueUrl = output["QueueUrl"];
}
return contents;
};
Expand Down Expand Up @@ -3025,10 +3006,7 @@ const deserializeAws_queryDeleteMessageBatchResultEntry = (
Id: undefined
};
if (output["Id"] !== undefined) {
contents.Id =
output["Id"]["#text"] !== undefined
? output["Id"]["#text"]
: output["Id"];
contents.Id = output["Id"];
}
return contents;
};
Expand Down Expand Up @@ -3081,10 +3059,7 @@ const deserializeAws_queryGetQueueUrlResult = (
QueueUrl: undefined
};
if (output["QueueUrl"] !== undefined) {
contents.QueueUrl =
output["QueueUrl"]["#text"] !== undefined
? output["QueueUrl"]["#text"]
: output["QueueUrl"];
contents.QueueUrl = output["QueueUrl"];
}
return contents;
};
Expand Down Expand Up @@ -3213,22 +3188,13 @@ const deserializeAws_queryMessage = (
);
}
if (output["Body"] !== undefined) {
contents.Body =
output["Body"]["#text"] !== undefined
? output["Body"]["#text"]
: output["Body"];
contents.Body = output["Body"];
}
if (output["MD5OfBody"] !== undefined) {
contents.MD5OfBody =
output["MD5OfBody"]["#text"] !== undefined
? output["MD5OfBody"]["#text"]
: output["MD5OfBody"];
contents.MD5OfBody = output["MD5OfBody"];
}
if (output["MD5OfMessageAttributes"] !== undefined) {
contents.MD5OfMessageAttributes =
output["MD5OfMessageAttributes"]["#text"] !== undefined
? output["MD5OfMessageAttributes"]["#text"]
: output["MD5OfMessageAttributes"];
contents.MD5OfMessageAttributes = output["MD5OfMessageAttributes"];
}
if (output.MessageAttribute === "") {
contents.MessageAttributes = {};
Expand All @@ -3240,16 +3206,10 @@ const deserializeAws_queryMessage = (
);
}
if (output["MessageId"] !== undefined) {
contents.MessageId =
output["MessageId"]["#text"] !== undefined
? output["MessageId"]["#text"]
: output["MessageId"];
contents.MessageId = output["MessageId"];
}
if (output["ReceiptHandle"] !== undefined) {
contents.ReceiptHandle =
output["ReceiptHandle"]["#text"] !== undefined
? output["ReceiptHandle"]["#text"]
: output["ReceiptHandle"];
contents.ReceiptHandle = output["ReceiptHandle"];
}
return contents;
};
Expand All @@ -3276,17 +3236,10 @@ const deserializeAws_queryMessageAttributeValue = (
);
}
if (output["BinaryValue"] !== undefined) {
contents.BinaryValue = context.base64Decoder(
output["BinaryValue"]["#text"] !== undefined
? output["BinaryValue"]["#text"]
: output["BinaryValue"]
);
contents.BinaryValue = context.base64Decoder(output["BinaryValue"]);
}
if (output["DataType"] !== undefined) {
contents.DataType =
output["DataType"]["#text"] !== undefined
? output["DataType"]["#text"]
: output["DataType"];
contents.DataType = output["DataType"];
}
if (output.StringListValue === "") {
contents.StringListValues = [];
Expand All @@ -3298,10 +3251,7 @@ const deserializeAws_queryMessageAttributeValue = (
);
}
if (output["StringValue"] !== undefined) {
contents.StringValue =
output["StringValue"]["#text"] !== undefined
? output["StringValue"]["#text"]
: output["StringValue"];
contents.StringValue = output["StringValue"];
}
return contents;
};
Expand Down Expand Up @@ -3343,10 +3293,7 @@ const deserializeAws_queryMessageSystemAttributeMap = (
context: __SerdeContext
): { [key: string]: string } => {
return output.reduce((acc: any, pair: any) => {
acc[pair["Name"]] =
pair["Value"]["#text"] !== undefined
? pair["Value"]["#text"]
: pair["Value"];
acc[pair["Name"]] = pair["Value"];
return acc;
}, {});
};
Expand Down Expand Up @@ -3376,10 +3323,7 @@ const deserializeAws_queryQueueAttributeMap = (
context: __SerdeContext
): { [key: string]: string } => {
return output.reduce((acc: any, pair: any) => {
acc[pair["Name"]] =
pair["Value"]["#text"] !== undefined
? pair["Value"]["#text"]
: pair["Value"];
acc[pair["Name"]] = pair["Value"];
return acc;
}, {});
};
Expand Down Expand Up @@ -3418,9 +3362,7 @@ const deserializeAws_queryQueueUrlList = (
output: any,
context: __SerdeContext
): string[] => {
return (output || []).map((entry: any) =>
entry["#text"] !== undefined ? entry["#text"] : entry
);
return (output || []).map((entry: any) => entry);
};

const deserializeAws_queryReceiptHandleIsInvalid = (
Expand Down Expand Up @@ -3497,40 +3439,23 @@ const deserializeAws_querySendMessageBatchResultEntry = (
SequenceNumber: undefined
};
if (output["Id"] !== undefined) {
contents.Id =
output["Id"]["#text"] !== undefined
? output["Id"]["#text"]
: output["Id"];
contents.Id = output["Id"];
}
if (output["MD5OfMessageAttributes"] !== undefined) {
contents.MD5OfMessageAttributes =
output["MD5OfMessageAttributes"]["#text"] !== undefined
? output["MD5OfMessageAttributes"]["#text"]
: output["MD5OfMessageAttributes"];
contents.MD5OfMessageAttributes = output["MD5OfMessageAttributes"];
}
if (output["MD5OfMessageBody"] !== undefined) {
contents.MD5OfMessageBody =
output["MD5OfMessageBody"]["#text"] !== undefined
? output["MD5OfMessageBody"]["#text"]
: output["MD5OfMessageBody"];
contents.MD5OfMessageBody = output["MD5OfMessageBody"];
}
if (output["MD5OfMessageSystemAttributes"] !== undefined) {
contents.MD5OfMessageSystemAttributes =
output["MD5OfMessageSystemAttributes"]["#text"] !== undefined
? output["MD5OfMessageSystemAttributes"]["#text"]
: output["MD5OfMessageSystemAttributes"];
output["MD5OfMessageSystemAttributes"];
}
if (output["MessageId"] !== undefined) {
contents.MessageId =
output["MessageId"]["#text"] !== undefined
? output["MessageId"]["#text"]
: output["MessageId"];
contents.MessageId = output["MessageId"];
}
if (output["SequenceNumber"] !== undefined) {
contents.SequenceNumber =
output["SequenceNumber"]["#text"] !== undefined
? output["SequenceNumber"]["#text"]
: output["SequenceNumber"];
contents.SequenceNumber = output["SequenceNumber"];
}
return contents;
};
Expand All @@ -3557,34 +3482,20 @@ const deserializeAws_querySendMessageResult = (
SequenceNumber: undefined
};
if (output["MD5OfMessageAttributes"] !== undefined) {
contents.MD5OfMessageAttributes =
output["MD5OfMessageAttributes"]["#text"] !== undefined
? output["MD5OfMessageAttributes"]["#text"]
: output["MD5OfMessageAttributes"];
contents.MD5OfMessageAttributes = output["MD5OfMessageAttributes"];
}
if (output["MD5OfMessageBody"] !== undefined) {
contents.MD5OfMessageBody =
output["MD5OfMessageBody"]["#text"] !== undefined
? output["MD5OfMessageBody"]["#text"]
: output["MD5OfMessageBody"];
contents.MD5OfMessageBody = output["MD5OfMessageBody"];
}
if (output["MD5OfMessageSystemAttributes"] !== undefined) {
contents.MD5OfMessageSystemAttributes =
output["MD5OfMessageSystemAttributes"]["#text"] !== undefined
? output["MD5OfMessageSystemAttributes"]["#text"]
: output["MD5OfMessageSystemAttributes"];
output["MD5OfMessageSystemAttributes"];
}
if (output["MessageId"] !== undefined) {
contents.MessageId =
output["MessageId"]["#text"] !== undefined
? output["MessageId"]["#text"]
: output["MessageId"];
contents.MessageId = output["MessageId"];
}
if (output["SequenceNumber"] !== undefined) {
contents.SequenceNumber =
output["SequenceNumber"]["#text"] !== undefined
? output["SequenceNumber"]["#text"]
: output["SequenceNumber"];
contents.SequenceNumber = output["SequenceNumber"];
}
return contents;
};
Expand All @@ -3593,20 +3504,15 @@ const deserializeAws_queryStringList = (
output: any,
context: __SerdeContext
): string[] => {
return (output || []).map((entry: any) =>
entry["#text"] !== undefined ? entry["#text"] : entry
);
return (output || []).map((entry: any) => entry);
};

const deserializeAws_queryTagMap = (
output: any,
context: __SerdeContext
): { [key: string]: string } => {
return output.reduce((acc: any, pair: any) => {
acc[pair["Key"]] =
pair["Value"]["#text"] !== undefined
? pair["Value"]["#text"]
: pair["Value"];
acc[pair["Key"]] = pair["Value"];
return acc;
}, {});
};
Expand Down Expand Up @@ -3706,7 +3612,7 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
parsedObjToReturn[key] = parsedObjToReturn[textNodeName];
delete parsedObjToReturn[textNodeName];
}
return parsedObjToReturn;
return __getValueFromTextNode(parsedObjToReturn);
}
return {};
});
Expand Down
Loading