Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle namespaced primitive types #79

Merged
merged 1 commit into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
modelNamePreffix: string;
modelNameSuffix: string;
maxRecursiveDefinitionName: number;
caseInsensitiveNames: boolean

Check warning on line 14 in src/parser.ts

View workflow job for this annotation

GitHub Actions / Tests & Typecheck

Insert `;`
}

const defaultOptions: ParserOptions = {
modelNamePreffix: "",
modelNameSuffix: "",
maxRecursiveDefinitionName: 64,
caseInsensitiveNames: false

Check warning on line 21 in src/parser.ts

View workflow job for this annotation

GitHub Actions / Tests & Typecheck

Insert `,`
};

type VisitedDefinition = {
Expand All @@ -45,6 +45,14 @@
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
Expand Down Expand Up @@ -111,7 +119,7 @@
name: stripedPropName,
sourceName: propName,
description: type,
type: NODE_SOAP_PARSED_TYPES[type] || "string",
type: toPrimitedType(type),
isArray: true,
});
} else if (type instanceof ComplexTypeElement) {
Expand Down Expand Up @@ -171,7 +179,7 @@
name: propName,
sourceName: propName,
description: type,
type: NODE_SOAP_PARSED_TYPES[type] || "string",
type: toPrimitedType(type),
isArray: false,
});
} else if (type instanceof ComplexTypeElement) {
Expand Down Expand Up @@ -259,7 +267,7 @@
maxStack: options.maxRecursiveDefinitionName,
caseInsensitiveNames: options.caseInsensitiveNames,
modelNamePreffix: options.modelNamePreffix,
modelNameSuffix: options.modelNameSuffix

Check warning on line 270 in src/parser.ts

View workflow job for this annotation

GitHub Actions / Tests & Typecheck

Insert `,`
});
const filename = path.basename(wsdlPath);
parsedWsdl.name = changeCase(stripExtension(filename), {
Expand Down
Loading