Skip to content

Commit 5ae4bce

Browse files
committed
Fix problem with parsing arrays and objects
1 parent f2f4581 commit 5ae4bce

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/parser.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function parseDefinition(
8585
definition.docs.push(`@targetNSAlias \`${type}\``);
8686
} else if (propName === "targetNamespace") {
8787
definition.docs.push(`@targetNamespace \`${type}\``);
88-
} else if (propName.endsWith("[]") || (typeof type === "string" && type.includes("ArrayOf"))) {
88+
} else if (propName.endsWith("[]")) {
8989
const stripedPropName = propName.substring(0, propName.length - 2);
9090
// Array of
9191
if (typeof type === "string") {
@@ -192,17 +192,13 @@ function parseDefinition(
192192
[...stack, propName],
193193
visitedDefs
194194
);
195-
if (typeof type === "object" && Object.keys(type)[0].includes("[]")) {
196-
definition.properties.push({ ...subDefinition.properties[0], name: propName });
197-
} else {
198-
definition.properties.push({
199-
kind: "REFERENCE",
200-
name: propName,
201-
sourceName: propName,
202-
ref: subDefinition,
203-
isArray: false,
204-
});
205-
}
195+
definition.properties.push({
196+
kind: "REFERENCE",
197+
name: propName,
198+
sourceName: propName,
199+
ref: subDefinition,
200+
isArray: false,
201+
});
206202
} catch (err) {
207203
const e = new Error(`Error while parsing Subdefinition for ${stack.join(".")}.${name}`);
208204
e.stack.split("\n").slice(0, 2).join("\n") + "\n" + err.stack;

0 commit comments

Comments
 (0)