jaysvcutil failing with TypeError: Cannot read property 'schemas' of undefined

372 Views Asked by At

I am trying to generate the model from an existing OData service through jaysvcutil and am getting:

[...]\node_modules\jaydata-odatajs\lib\odata\odatautils.js:385
            throw err;
            ^

TypeError: Cannot read property 'schemas' of undefined
    at Metadata.processMetadata ([...]\node_modules\jaydata-dynamic-metadata\lib\metadata.js:353:35)
    at requestData ([...]\node_modules\jaydata-dynamic-metadata\lib\metadataHandler.js:46:42)
    at [...]\node_modules\jaydata-odatajs\lib\odata\odatautils.js:382:13
    at IncomingMessage.<anonymous> ([...]\node_modules\jaydata-odatajs\lib\odata\net.js:179:21)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:921:12)
    at nextTickCallbackWith2Args (node.js:442:9)
    at process._tickCallback (node.js:356:17)

I tried to condense the domain model into something really simple, so my current $metadata looks like this:

<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" Version="1.0">
    <edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="1.0">
        <Schema xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2007/05/edm" Namespace="data">
            <EntityType Name="Product">
                <Key>
                    <PropertyRef Name="ProductId"/>
                </Key>
                <Property Name="ProductId" Type="Edm.Int64" Nullable="false"/>
                <Property Name="ProductNo" Type="Edm.String" Nullable="true"/>
                <Property Name="LifeTime" Type="Edm.Int64" Nullable="false"/>
                <Property Name="Capacity" Type="Edm.Int64" Nullable="false"/>
                <Property Name="PackingSize" Type="Edm.Int64" Nullable="false"/>
                <Property Name="CreationTime" Type="Edm.DateTime" Nullable="false"/>
                <Property Name="ModificationTime" Type="Edm.DateTime" Nullable="false"/>
            </EntityType>
        </Schema>
        <Schema xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2007/05/edm" Namespace="Namespace">
            <EntityContainer Name="DomainData" m:IsDefaultEntityContainer="true">
                <EntitySet Name="Product" EntityType="data.Product"/>
            </EntityContainer>
        </Schema>
    </edmx:DataServices>
</edmx:Edmx>

This is an existing WCF DataService based OData provider using OData V1 and I am not able to change that - so please do not recommend updating the provider to V4.

Any help would be appreciated.

1

There are 1 best solutions below

0
user1211286 On

As per feedback from the JayData team:

JayData supports OData v4, as there have been multiple breaking changes in both OData and DataJS since v1.

and also

JayData 1.3.7 supports v2 and v3, but it does not support TypeScript and Angular 2.

I will therefore be looking at alternatives, presumably breezejs.