TimLuq / wsdl-to-ts

Generate TypeScript typings for WSDL services
ISC License
61 stars 48 forks source link

"xs:string" instead of "string" #3

Closed sosoba closed 6 years ago

sosoba commented 6 years ago

Try: wsdl-to-ts https://wyszukiwarkaregontest.stat.gov.pl/wsBIR/wsdl/UslugaBIRzewnPubl.xsd

Result:

export interface ISprawdzCaptchaInput { /* xs:string(undefined) / pCaptcha: xs:string; }

KevinSnyderCodes commented 6 years ago

Same issue using a WSDL file with:

<s:element name="ElementName" type="s:string" />

The generated TypeScript definition looks something like:

export interface MyInterface {
    ElementName: s:string;
}
ugo-gagliardelli commented 6 years ago

That happens with xsd:int that should be translated as number. Also, when a wsdl operation has no input parameters, an empty interface is created in .ts file, that's marked as an error.

TimLuq commented 6 years ago

PR #6 is a partial fix for this issue. Most people have problems which should be taken care of.

The rest of the problems are harder to take care of such as the above mentioned xs:int -> number, since this would require an exhaustive list of type translations.

Regarding empty interfaces; they are a bad practice but not disallowed by TypeScript. If they are allowed or not is dependent on your tslint configuration for that project. What should be done is turn off that check in the generated files in the same way I've disabled the check for max line lengths, please open a separate issue for this.

gitowiec commented 6 years ago

What's with this issue? I generated typescript file which is useless because of types prefixed with xsd: How to use this package if that is correctly generated typescript?

TimLuq commented 6 years ago

@gitowiec The partial fix is included in v0.2. Before then you would've had to use a git dependency to get the naively-remove-everything-before-the-colon-if-there-is-one effect.

(The deleted comment from sosoba above seem to have been an autoreply to the notification email. As such I expect there is a chance that one more might arrive b/c of this message.)

ghost commented 5 years ago

The rest of the problems are harder to take care of such as the above mentioned xs:int -> number, since this would require an exhaustive list of type translations.

Is there any plan in doing this ? Because right now i'm having wsdl converted in "ts" which contains both 'int', 'long', 'bool' and arrays that seems to be buggy (i got 4 fields looking like : name : string>; ).

Thanks for your help :)