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

TypeError: Cannot use 'in' operator to search for 'undefined'

Open d0x opened this issue 2 years ago • 0 comments

When generating a client for the Domibus.wsdl, wsdl-tsclient throws the following error: TypeError: Cannot use 'in' operator to search for 'undefined'

I reduced the wsdl to isolate the issue. You can reproduce it with the following minimal wsdl:

<?xml version='1.0' encoding='UTF-8'?>
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:tns="http://org.ecodex.backend/1_1/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
                  name="BackendService_1_1"
                  targetNamespace="http://org.ecodex.backend/1_1/">
    <wsdl:types>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://org.ecodex.backend/1_1/"
                    targetNamespace="http://org.ecodex.backend/1_1/">
            <xsd:simpleType name="max255-non-empty-string">
                <xsd:restriction base="xsd:string">
                    <xsd:minLength value="1"/>
                    <xsd:maxLength value="255"/>
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:element name="getStatusResponse" nillable="true" type="tns:max255-non-empty-string"/>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="getStatusResponse">
        <wsdl:part element="tns:getStatusResponse" name="getStatusResponse">
        </wsdl:part>
    </wsdl:message>
    <wsdl:portType name="BackendInterface">
        <wsdl:operation name="getStatus">
            <wsdl:input message="tns:getStatusResponse" name="getStatus">
            </wsdl:input>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="BackendService_1_1SoapBinding" type="tns:BackendInterface">
        <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="getStatus">
            <soap12:operation soapAction="" style="document"/>
            <wsdl:output name="getStatusResponse">
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="BackendService_1_1">
        <wsdl:port binding="tns:BackendService_1_1SoapBinding" name="BACKEND_PORT">
            <soap12:address location="http://localhost:8081/domibus/services/backend"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

produces this compilation error:

TypeError: Cannot use 'in' operator to search for 'undefined' in max255-non-empty-string|xsd:string|minLength,maxLength

I tests it using "wsdl-tsclient": "1.3.1" and node v16.13.2

d0x avatar Mar 06 '22 00:03 d0x