Skip to content

Commit

Permalink
chore: codegen decode escaped xml (#959)
Browse files Browse the repository at this point in the history
* Codegen for fixing decode escaped XML([#952](#952))
  • Loading branch information
Chase Coalwell authored Mar 2, 2020
1 parent 76553cf commit a9d87f9
Show file tree
Hide file tree
Showing 22 changed files with 242 additions and 22 deletions.
12 changes: 11 additions & 1 deletion clients/client-auto-scaling/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9238,13 +9238,23 @@ const buildHttpRpcRequest = (
return new __HttpRequest(contents);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&/g, "&")
.replace(/'/g, "'")
.replace(/"/g, '"')
.replace(/>/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-cloudformation/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10484,13 +10484,23 @@ const buildHttpRpcRequest = (
return new __HttpRequest(contents);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-cloudfront/protocols/Aws_restXml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12672,13 +12672,23 @@ const collectBodyString = (
);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-cloudsearch/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5529,13 +5529,23 @@ const buildHttpRpcRequest = (
return new __HttpRequest(contents);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-cloudwatch/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5859,13 +5859,23 @@ const buildHttpRpcRequest = (
return new __HttpRequest(contents);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-docdb/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9589,13 +9589,23 @@ const buildHttpRpcRequest = (
return new __HttpRequest(contents);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-ec2/protocols/Aws_ec2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73121,13 +73121,23 @@ const buildHttpRpcRequest = (
return new __HttpRequest(contents);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-elastic-beanstalk/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8711,13 +8711,23 @@ const buildHttpRpcRequest = (
return new __HttpRequest(contents);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-elastic-load-balancing-v2/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8723,13 +8723,23 @@ const buildHttpRpcRequest = (
return new __HttpRequest(contents);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-elastic-load-balancing/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6079,13 +6079,23 @@ const buildHttpRpcRequest = (
return new __HttpRequest(contents);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-elasticache/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12058,13 +12058,23 @@ const buildHttpRpcRequest = (
return new __HttpRequest(contents);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-iam/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20615,13 +20615,23 @@ const buildHttpRpcRequest = (
return new __HttpRequest(contents);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-neptune/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13275,13 +13275,23 @@ const buildHttpRpcRequest = (
return new __HttpRequest(contents);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-rds/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28357,13 +28357,23 @@ const buildHttpRpcRequest = (
return new __HttpRequest(contents);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-redshift/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19538,13 +19538,23 @@ const buildHttpRpcRequest = (
return new __HttpRequest(contents);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
12 changes: 11 additions & 1 deletion clients/client-route-53/protocols/Aws_restXml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9546,13 +9546,23 @@ const collectBodyString = (
);
};

const decodeEscapedXML = (str: string) => {
return str
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, ">")
.replace(/&lt;/g, "<");
};

const parseBody = (streamBody: any, context: __SerdeContext): any => {
return collectBodyString(streamBody, context).then(encoded => {
if (encoded.length) {
const parsedObj = xmlParse(encoded, {
attributeNamePrefix: "",
ignoreAttributes: false,
parseNodeValue: false
parseNodeValue: false,
tagValueProcessor: (val, tagName) => decodeEscapedXML(val)
});
return parsedObj[Object.keys(parsedObj)[0]];
}
Expand Down
Loading

0 comments on commit a9d87f9

Please sign in to comment.