From 0be195414ca7cf8009ebc9c0b1a5a0d62b54216a Mon Sep 17 00:00:00 2001 From: Ilia Choly Date: Fri, 3 May 2024 08:58:44 -0400 Subject: [PATCH] Handle namespaced primitive types --- src/parser.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/parser.ts b/src/parser.ts index 336ac1f..a945845 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -45,6 +45,14 @@ const NODE_SOAP_PARSED_TYPES: { [type: string]: string } = { date: "Date", }; +function toPrimitedType(type: string): string { + const index = type.indexOf(":"); + if (index >= 0) { + type = type.substring(index + 1); + } + return NODE_SOAP_PARSED_TYPES[type] || "string"; +} + /** * parse definition * @param parsedWsdl context of parsed wsdl @@ -111,7 +119,7 @@ function parseDefinition( name: stripedPropName, sourceName: propName, description: type, - type: NODE_SOAP_PARSED_TYPES[type] || "string", + type: toPrimitedType(type), isArray: true, }); } else if (type instanceof ComplexTypeElement) { @@ -171,7 +179,7 @@ function parseDefinition( name: propName, sourceName: propName, description: type, - type: NODE_SOAP_PARSED_TYPES[type] || "string", + type: toPrimitedType(type), isArray: false, }); } else if (type instanceof ComplexTypeElement) {