wsdl-tsclient icon indicating copy to clipboard operation
wsdl-tsclient copied to clipboard

Generated types clash and fail to compile

Open BernhardPosselt opened this issue 4 years ago • 5 comments

I've got the following WSDL spec which fails to compile with

gensrc/oil/salesorderv201901/definitions/ProductLineItemUpdateOrderRequest.ts:1:33 - error TS1149: File name 'gensrc/oil/salesorderv201901/definitions/ProductLineItem.ts' differs from already included file name 'gensrc/oil/salesorderv201901/definitions/ProductLineitem.ts' only in casing.

SalesOrder_v201901.txt

BernhardPosselt avatar Aug 23 '21 09:08 BernhardPosselt

Any news on this or #46 ? Have any maintainers went through this ?

Clovel avatar Oct 04 '22 17:10 Clovel

I have a similar situation where the wsdl-tsclient CLI made duplicates :

image

Any idea how I could fix this ?

Clovel avatar Oct 04 '22 17:10 Clovel

I ended up just manually adding aliases for the clashing names, like:

export { WebPaymentApi as WebPaymentApiService } from "./services/WebPaymentApi";
export { WebPaymentApi as WebPaymentApiPort } from "./ports/WebPaymentApi";

Same in the services/WebPaymentApi.ts file (alias for port).

I don't mind that much as I only have one service and my wsdl is quite stable. But would be nice if the the tool would detect those kind of duplications itself - or at least provide a standardized way to provide aliases. It seems like it's not very unlikely that a real-life wsdl would result in duplications like that...

If it would bother me more and/or I had the time, I might try to fix it myself with a pull request...

pazoozooCH avatar Nov 09 '22 10:11 pazoozooCH

If fixed this using a JS script that patches the files after having generated the code. It's more of a workaround than a real fix of the wsdl-tsclient library.

I can share the script if you want to. I used regular expressions to find and replace the duplicates.

const lServiceExportRegEx = /export { ([A-Za-z]*) } from ".\/services\/\1";/gm;
const lPortExportRegEx = /export { ([A-Za-z]*) } from ".\/ports\/\1";/gm;
const lPortImportRegEx = /import { ([A-Za-z]*) } from "..\/ports\/\1";/gm;
const lServiceInterfaceRegEx = /readonly ([A-Za-z]*): \1;/gm;

const lServiceSubValue = `export { $1 as $1Service } from "./services/$1";`;
const lPortSubValue = `export { $1 as $1Port } from "./ports/$1";`;
const lPortImportSubValue = `import { $1 as $1Port } from "../ports/$1";`;
const lServiceInterfaceSubValue = `readonly $1: $1Port;`;

Clovel avatar Nov 09 '22 13:11 Clovel

Still an issue for us.

extradosages avatar Mar 21 '23 21:03 extradosages