jaydata
jaydata copied to clipboard
refStorageModel is undefined (SP2013 REST $metadata)
The conversion of an huge SharePoint 2013 $metadata file with JaySvcUtil was successful (with the usual warnings), but now when I try to load the file I'm getting a refStorageModel is undefined
error.
See this gist for details
Just as an update. The issue happens in jaydata.js line 12345
where the following assingment refStorageModel = this._storageModel.getStorageModel(Container.resolveType(memDef.elementType));
leads to a refStorageModel
that is undefined
. The following var p = refStorageModel
therefore throws an error.
It seems that the SP2013 $metadata has some unusual design, which isn't fully addressed by either the XSLT transformation or in the JayData.js logic.
} else {
var refStorageModel = null;
if (memDefResolvedDataType === $data.Array || (memDefResolvedDataType.isAssignableTo && memDefResolvedDataType.isAssignableTo($data.EntitySet))) {
refStorageModel = this._storageModel.getStorageModel(Container.resolveType(memDef.elementType));
} else {
refStorageModel = this._storageModel.getStorageModel(memDefResolvedDataType);
}
var p = refStorageModel.LogicalType.memberDefinitions.getMember(memDef.inverseProperty);
if (p) {
if (p.inverseProperty) {
if (p.inverseProperty != memDef.name) {
if (typeof intellisense === 'undefined') {
Guard.raise(new Exception('Inverse property mismatch'));
}
}
} else {
p.inverseProperty = memDef.name;
}
}
This is driving me nuts ;-).
refStorageModel
is undefined because in the below filterExpression there's no match for resolveType Assignment()
with a fullName of EDU.Assignment
.
The only Assignment()
LogicalType that I could found in ctx._storageModel
has a fullName of PS.Assignment
, so it's clearly not what we're looking for.
return ctx._storageModel.filter(function (s) { return s.LogicalType === resolvedType; })[0];
I'm wondering if multiple Namespaces (there are at least EDU, Microsoft, OBA, PS, SP) in combination with two EnityContainer (ApiData and ListData) are currently supported by JaySvcUtil/JayData?
This makes sense. The multiple namespaces should not be a problem rather multiple entity containers where I guess we are following WCF implementation limitation that practically prohibits entities from different contexts. But this does not make it necessary to not support this use case on the client. Could you share the huge $metadata file? I have a previous version is that the same? UPDATE: i found all the necessary files to investigate. Also, I have a lead on the error, caused by a small bug (and not conceptual inability). stay tuned :)
And thanks for being relentless :) hope I can resolve this quickly. BTW we made our second presentation to the OData team @ Microsoft and we were proud to showcase your Sharepoint based achievements (by showing off your blog screens) as one of the coolest JayData dev examples. Thanks for making this possible.
Here you go on the $metadata file: https://raw.github.com/gist/3273362/6fa3b3bc4d918e5084ea58ac8e479d0659b296be/_api$metadata.xml
and here's the complete gist with $metadata, converted js and log file https://gist.github.com/3273362.
Let me know if you need further information.
Glad to hear that I'm being used as the coolest JayData dev example
. Next is to take over the Office 365 / SharePoint 2013 Napa development... just kidding ;-)
:) yeah. FYI your deeds will be a major battle card in a campaign soon starting (I do hope I can persuade somebody from the OData team to participate) that aims to "take on AJAX". Well, I am not planning on "killing" AJAX, but to have AJAX disappear from the client aspects of the business or data layer of an HTML5/hybrid/browser application. The banner we are gathering under could read: "Dear $.ajax/xhr thank you for being around (and in every event handler) for about 15 years, but now it's time for you to go under the hood and be rarely if ever visible".
To my believe the OData format has the capability to provide the wire format for most AJAX RPC scenarios.
I've got the same error ;( Here is a metadata: https://gist.github.com/4051660 JayData can't find a storage model for YoStat.Models.Variable. It seems that context contains a storage model only for YoStat.Models.BaseVariable... Does Jay Data support entity inheritance? And does it support polymorphic collections? Thanks!
OData v3 features and inheritance support will be released with JayData 1.3, let's see if this still happens or not.