Right now the osapi apis are doing some transformation to the json coming
back from the server like this:
var getDataFromResult = function(result) {
var jsonArray = result.data;
if (jsonArray[0].error) {
return { error : { code : osapi.translateHttpError("Error "+
jsonArray[0].error.code),
message : jsonArray[0].error.message}};
} else if (jsonArray[0].data.list) {
return jsonArray[0].data.list;
} else {
return jsonArray[0].data;
}
};
The first error processing and the last jsonArray[0].data case are fine, but
I believe the middle case is a bug which needs to be removed. When you fetch
a list of friends there are many properties on the data object in addition
to .list, like totalResults, startIndex etc Just returning .list is
obscuring data from the caller and prevents pagination.
Data pipelining is not stripping this data out so I think we just have a
small mismatch in the code. Does anyone have any problems with removing
this? :
else if (jsonArray[0].data.list) {
return jsonArray[0].data.list;
}
I don't see mention of it in the spec.
- Cassie