Bug in datajs beta2 1.1.1?

Jul 9, 2013 at 1:03 PM
Hi guys:

I get an error when using the new datajs 1.1.1 beta2:

This worked before.
Here is the code:

Error:
-->Cannot set property 'contentTypeOdata' of null"
var sURL1 = "http://services.odata.org/(S(readwrite))/OData/OData.svc/$metadata";
var sURL2 = "http://services.odata.org/(S(readwrite))/OData/OData.svc/Products?$expand=Category";


var oRequest = { 
            requestUri : sURL1,
    };

OData.read(oRequest, function(oMetadata){

    var oRequest = { 
            requestUri : sURL2,
    };



OData.read(oRequest, function (oData) { 
    debugger;
    alert('success');
},
  function(oError){
       alert (oError.message);
},null,null,oMetadata);


}, function(oError){
       alert (oError.message);
}, OData.metadataHandler);
This happens only when I read the metadata first and hand it over to the next request and when using the expand property...

Crash happens in jsonLightReadObject:
var propertyValue = data[name];
                var propertyModel = jsonLightDataItemModel(name, dataModel);
                var isNavigationProperty = jsonLightIsNavigationProperty(name, data, propertyModel);
                var propertyType = jsonLightDataItemType(name, propertyValue, data, propertyModel, model);
                var propertyMetadata = propertiesMetadata[name] = propertiesMetadata[name] || { type: propertyType };
                if (isNavigationProperty) {
                    var propertyInfo = {};
                    if (objectInfo.entitySet !== undefined) {
                        var navigationPropertyEntitySetName = lookupNavigationPropertyEntitySet(propertyModel, objectInfo.entitySet.name, model);
                        propertyInfo = getEntitySetInfo(navigationPropertyEntitySetName, model);
                    }
                    propertyInfo.contentTypeOdata = objectInfo.contentTypeOdata;
propertyInfo is null
Could you please check this?

Thanks!
Joe
Coordinator
Jul 10, 2013 at 11:44 PM
Hi Joe,

Thanks for reporting the issue.
It happens when there you do a request for json with fullmetadata and there is type inheritance on the type like your case it fails on the FeaturedProduct entity.
This will be fixed in the 1.1.1 release.

Hussein
Jul 11, 2013 at 3:27 PM
Hi nomier,

thank you very much :)
When will 1.1.1 be available?

Thanks and best regards
Joe
Coordinator
Jul 16, 2013 at 11:23 PM
Hi Joe,

DataJS 1.1.1 is released now and contains the fix.


Regards,
Hussein Nomier