Skip to content

Commit

Permalink
Reduce xml deser size with empty object (#4565)
Browse files Browse the repository at this point in the history
* chore(codegen): reduce XML deser size by not defining empty object

We don't need to define the entire object up front and can instead
just add values to the result if they are present. This has the
net effect of -14k lines of generated code across XML services.

* chore(codegen): generate XML deserializers

---------

Co-authored-by: Michael Dowling <[email protected]>
  • Loading branch information
srchase and mtdowling authored Mar 22, 2023
1 parent 023f661 commit 247b51f
Show file tree
Hide file tree
Showing 28 changed files with 3,691 additions and 18,198 deletions.
722 changes: 112 additions & 610 deletions clients/client-auto-scaling/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

885 changes: 130 additions & 755 deletions clients/client-cloudformation/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

1,010 changes: 153 additions & 857 deletions clients/client-cloudfront/src/protocols/Aws_restXml.ts

Large diffs are not rendered by default.

368 changes: 65 additions & 303 deletions clients/client-cloudsearch/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

411 changes: 64 additions & 347 deletions clients/client-cloudwatch/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

727 changes: 135 additions & 592 deletions clients/client-docdb/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

6,934 changes: 1,059 additions & 5,875 deletions clients/client-ec2/src/protocols/Aws_ec2.ts

Large diffs are not rendered by default.

600 changes: 96 additions & 504 deletions clients/client-elastic-beanstalk/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

504 changes: 97 additions & 407 deletions clients/client-elastic-load-balancing-v2/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

309 changes: 63 additions & 246 deletions clients/client-elastic-load-balancing/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

1,013 changes: 174 additions & 839 deletions clients/client-elasticache/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

942 changes: 159 additions & 783 deletions clients/client-iam/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

989 changes: 171 additions & 818 deletions clients/client-neptune/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

2,002 changes: 330 additions & 1,672 deletions clients/client-rds/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

1,507 changes: 281 additions & 1,226 deletions clients/client-redshift/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

265 changes: 36 additions & 229 deletions clients/client-route-53/src/protocols/Aws_restXml.ts

Large diffs are not rendered by default.

619 changes: 101 additions & 518 deletions clients/client-s3-control/src/protocols/Aws_restXml.ts

Large diffs are not rendered by default.

524 changes: 88 additions & 436 deletions clients/client-s3/src/protocols/Aws_restXml.ts

Large diffs are not rendered by default.

489 changes: 95 additions & 394 deletions clients/client-ses/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

289 changes: 65 additions & 224 deletions clients/client-sns/src/protocols/Aws_query.ts

Large diffs are not rendered by default.

95 changes: 17 additions & 78 deletions clients/client-sqs/src/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2170,12 +2170,7 @@ const deserializeAws_queryBatchRequestTooLong = (output: any, context: __SerdeCo
};

const deserializeAws_queryBatchResultErrorEntry = (output: any, context: __SerdeContext): BatchResultErrorEntry => {
const contents: any = {
Id: undefined,
SenderFault: undefined,
Code: undefined,
Message: undefined,
};
const contents: any = {};
if (output["Id"] !== undefined) {
contents.Id = __expectString(output["Id"]);
}
Expand Down Expand Up @@ -2214,10 +2209,7 @@ const deserializeAws_queryChangeMessageVisibilityBatchResult = (
output: any,
context: __SerdeContext
): ChangeMessageVisibilityBatchResult => {
const contents: any = {
Successful: undefined,
Failed: undefined,
};
const contents: any = {};
if (output.ChangeMessageVisibilityBatchResultEntry === "") {
contents.Successful = [];
} else if (output["ChangeMessageVisibilityBatchResultEntry"] !== undefined) {
Expand All @@ -2241,9 +2233,7 @@ const deserializeAws_queryChangeMessageVisibilityBatchResultEntry = (
output: any,
context: __SerdeContext
): ChangeMessageVisibilityBatchResultEntry => {
const contents: any = {
Id: undefined,
};
const contents: any = {};
if (output["Id"] !== undefined) {
contents.Id = __expectString(output["Id"]);
}
Expand All @@ -2262,9 +2252,7 @@ const deserializeAws_queryChangeMessageVisibilityBatchResultEntryList = (
};

const deserializeAws_queryCreateQueueResult = (output: any, context: __SerdeContext): CreateQueueResult => {
const contents: any = {
QueueUrl: undefined,
};
const contents: any = {};
if (output["QueueUrl"] !== undefined) {
contents.QueueUrl = __expectString(output["QueueUrl"]);
}
Expand All @@ -2275,10 +2263,7 @@ const deserializeAws_queryDeleteMessageBatchResult = (
output: any,
context: __SerdeContext
): DeleteMessageBatchResult => {
const contents: any = {
Successful: undefined,
Failed: undefined,
};
const contents: any = {};
if (output.DeleteMessageBatchResultEntry === "") {
contents.Successful = [];
} else if (output["DeleteMessageBatchResultEntry"] !== undefined) {
Expand All @@ -2302,9 +2287,7 @@ const deserializeAws_queryDeleteMessageBatchResultEntry = (
output: any,
context: __SerdeContext
): DeleteMessageBatchResultEntry => {
const contents: any = {
Id: undefined,
};
const contents: any = {};
if (output["Id"] !== undefined) {
contents.Id = __expectString(output["Id"]);
}
Expand All @@ -2331,9 +2314,7 @@ const deserializeAws_queryGetQueueAttributesResult = (
output: any,
context: __SerdeContext
): GetQueueAttributesResult => {
const contents: any = {
Attributes: undefined,
};
const contents: any = {};
if (output.Attribute === "") {
contents.Attributes = {};
} else if (output["Attribute"] !== undefined) {
Expand All @@ -2343,9 +2324,7 @@ const deserializeAws_queryGetQueueAttributesResult = (
};

const deserializeAws_queryGetQueueUrlResult = (output: any, context: __SerdeContext): GetQueueUrlResult => {
const contents: any = {
QueueUrl: undefined,
};
const contents: any = {};
if (output["QueueUrl"] !== undefined) {
contents.QueueUrl = __expectString(output["QueueUrl"]);
}
Expand Down Expand Up @@ -2376,10 +2355,7 @@ const deserializeAws_queryListDeadLetterSourceQueuesResult = (
output: any,
context: __SerdeContext
): ListDeadLetterSourceQueuesResult => {
const contents: any = {
queueUrls: undefined,
NextToken: undefined,
};
const contents: any = {};
if (output.QueueUrl === "") {
contents.queueUrls = [];
} else if (output["QueueUrl"] !== undefined) {
Expand All @@ -2392,10 +2368,7 @@ const deserializeAws_queryListDeadLetterSourceQueuesResult = (
};

const deserializeAws_queryListQueuesResult = (output: any, context: __SerdeContext): ListQueuesResult => {
const contents: any = {
NextToken: undefined,
QueueUrls: undefined,
};
const contents: any = {};
if (output["NextToken"] !== undefined) {
contents.NextToken = __expectString(output["NextToken"]);
}
Expand All @@ -2408,9 +2381,7 @@ const deserializeAws_queryListQueuesResult = (output: any, context: __SerdeConte
};

const deserializeAws_queryListQueueTagsResult = (output: any, context: __SerdeContext): ListQueueTagsResult => {
const contents: any = {
Tags: undefined,
};
const contents: any = {};
if (output.Tag === "") {
contents.Tags = {};
} else if (output["Tag"] !== undefined) {
Expand All @@ -2420,15 +2391,7 @@ const deserializeAws_queryListQueueTagsResult = (output: any, context: __SerdeCo
};

const deserializeAws_queryMessage = (output: any, context: __SerdeContext): Message => {
const contents: any = {
MessageId: undefined,
ReceiptHandle: undefined,
MD5OfBody: undefined,
Body: undefined,
Attributes: undefined,
MD5OfMessageAttributes: undefined,
MessageAttributes: undefined,
};
const contents: any = {};
if (output["MessageId"] !== undefined) {
contents.MessageId = __expectString(output["MessageId"]);
}
Expand Down Expand Up @@ -2464,13 +2427,7 @@ const deserializeAws_queryMessage = (output: any, context: __SerdeContext): Mess
};

const deserializeAws_queryMessageAttributeValue = (output: any, context: __SerdeContext): MessageAttributeValue => {
const contents: any = {
StringValue: undefined,
BinaryValue: undefined,
StringListValues: undefined,
BinaryListValues: undefined,
DataType: undefined,
};
const contents: any = {};
if (output["StringValue"] !== undefined) {
contents.StringValue = __expectString(output["StringValue"]);
}
Expand Down Expand Up @@ -2587,9 +2544,7 @@ const deserializeAws_queryReceiptHandleIsInvalid = (output: any, context: __Serd
};

const deserializeAws_queryReceiveMessageResult = (output: any, context: __SerdeContext): ReceiveMessageResult => {
const contents: any = {
Messages: undefined,
};
const contents: any = {};
if (output.Message === "") {
contents.Messages = [];
} else if (output["Message"] !== undefined) {
Expand All @@ -2599,10 +2554,7 @@ const deserializeAws_queryReceiveMessageResult = (output: any, context: __SerdeC
};

const deserializeAws_querySendMessageBatchResult = (output: any, context: __SerdeContext): SendMessageBatchResult => {
const contents: any = {
Successful: undefined,
Failed: undefined,
};
const contents: any = {};
if (output.SendMessageBatchResultEntry === "") {
contents.Successful = [];
} else if (output["SendMessageBatchResultEntry"] !== undefined) {
Expand All @@ -2626,14 +2578,7 @@ const deserializeAws_querySendMessageBatchResultEntry = (
output: any,
context: __SerdeContext
): SendMessageBatchResultEntry => {
const contents: any = {
Id: undefined,
MessageId: undefined,
MD5OfMessageBody: undefined,
MD5OfMessageAttributes: undefined,
MD5OfMessageSystemAttributes: undefined,
SequenceNumber: undefined,
};
const contents: any = {};
if (output["Id"] !== undefined) {
contents.Id = __expectString(output["Id"]);
}
Expand Down Expand Up @@ -2667,13 +2612,7 @@ const deserializeAws_querySendMessageBatchResultEntryList = (
};

const deserializeAws_querySendMessageResult = (output: any, context: __SerdeContext): SendMessageResult => {
const contents: any = {
MD5OfMessageBody: undefined,
MD5OfMessageAttributes: undefined,
MD5OfMessageSystemAttributes: undefined,
MessageId: undefined,
SequenceNumber: undefined,
};
const contents: any = {};
if (output["MD5OfMessageBody"] !== undefined) {
contents.MD5OfMessageBody = __expectString(output["MD5OfMessageBody"]);
}
Expand Down
Loading

0 comments on commit 247b51f

Please sign in to comment.