Skip to content

Commit 5ccb442

Browse files
authored
fix(codegen): remove custom entity code in xml protocol test stub (#1968)
1 parent b877fc2 commit 5ccb442

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/TypeScriptDependency.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public enum TypeScriptDependency implements Dependency {
110110
AWS_SDK_QUERYSTRING_BUILDER("dependencies", "@smithy/querystring-builder", false),
111111

112112
// Conditionally added when XML parser needs to be used.
113-
XML_PARSER("dependencies", "fast-xml-parser", "5.2.5", false),
113+
XML_PARSER("dependencies", "fast-xml-parser", "5.7.1", false),
114114
HTML_ENTITIES("dependencies", "entities", "2.2.0", false),
115115

116116
// Conditionally added when streaming blob response payload exists.

smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/protocol-test-xml-stub.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
* Returns a map of key names that were un-equal to value objects showing the
33
* discrepancies between the components.
44
*/
5-
const compareEquivalentXmlBodies = (
6-
expectedBody: string,
7-
generatedBody: string
8-
): Object => {
5+
const compareEquivalentXmlBodies = (expectedBody: string, generatedBody: string): Object => {
96
const parseConfig = {
107
attributeNamePrefix: "",
8+
processEntities: {
9+
enabled: true,
10+
maxTotalExpansions: Infinity,
11+
},
1112
htmlEntities: true,
1213
ignoreAttributes: false,
1314
ignoreDeclaration: true,
1415
parseTagValue: false,
1516
trimValues: false,
1617
tagValueProcessor: (_: any, val: any) => (val.trim() === "" && val.includes("\n") ? "" : undefined),
18+
maxNestedTags: Infinity,
1719
};
1820

1921
const parseXmlBody = (body: string) => {
2022
const parser = new XMLParser(parseConfig);
21-
parser.addEntity("#xD", "\r");
22-
parser.addEntity("#10", "\n");
2323
const parsedObj = parser.parse(body);
2424
const textNodeName = "#text";
2525
const key = Object.keys(parsedObj)[0];

0 commit comments

Comments
 (0)