You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Chris Chabot <ch...@google.com> on 2008/10/08 19:09:26 UTC

opensocial idspec confusing the out of me

Hey Bob, Louis & shindig-dev,

While testing the new social api i've commited today i've run into the
strangest thing... depending on if a gadget uses the opensocial-0.7 or 0.8
feature, the idSpec that it recieves is completely different in it's format
... And i can't seem to make sense out of it.

See when I do this in a Require feature="opensocial-0.7" gadget:
var req = opensocial.newDataRequest();
req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS),
'viewerFriends');
.. etc..

firebug shows that the request on the wire is (as i would expect it to be):
{"method":"people.get","params":{
*"userId":["@viewer"], "groupId":"@friends",
*
"fields":["id","name","thumbnailUrl","id","displayName"],"count":20,"sortBy":"topFriends","filterBy":"all"},"id":"viewerFriends"}

However when I fire up a opensocial-0.8 using gadget that does:
  var req = opensocial.newDataRequest();
  var spec = opensocial.newIdSpec({"userId" : "VIEWER", "groupId" :
"FRIENDS"});
  var params = { "max" : 10};
  req.add(req.newFetchPeopleRequest(spec, params), "req_friends");

firebug (and the crashing and burning php code) tells me the request is now:

{"method":"people.get","params":{
*
"userId":[{"fields_":{"userId":"VIEWER","groupId":"FRIENDS"}}],"groupId":"@self",
*
"fields":["id","name","thumbnailUrl","id","displayName"],"count":1000,"sortBy":"topFriends","filterBy":"all"},"id":"req_friends"}

Now maybe i miss-read the json-rpc spec document, but that data format
doesn't look familiar to me ... an object with a fields_ property and in it
the userId and groupId? that can't be right, right?

I'd like have this confirmed before i start butchering my code to compensate
for this oddity :)

   -- Chris

Re: opensocial idspec confusing the out of me

Posted by Chris Chabot <ch...@google.com>.
Doh!

problem solved, I had forcedJsLibs = ...opensocial-0.7... which then ofc got
included with 0.8 gadgets too, and hence the messed up idSpec, my bad!

On Wed, Oct 8, 2008 at 7:11 PM, Louis Ryan <lr...@google.com> wrote:

> This looks like a JSON conversion bug in the IdSpec object or in the
> jsonrpccontainer. Ill take a look....
>
>
> On Wed, Oct 8, 2008 at 10:09 AM, Chris Chabot <ch...@google.com> wrote:
>
>> Hey Bob, Louis & shindig-dev,
>>
>> While testing the new social api i've commited today i've run into the
>> strangest thing... depending on if a gadget uses the opensocial-0.7 or 0.8
>> feature, the idSpec that it recieves is completely different in it's format
>> ... And i can't seem to make sense out of it.
>>
>> See when I do this in a Require feature="opensocial-0.7" gadget:
>> var req = opensocial.newDataRequest();
>> req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS),
>> 'viewerFriends');
>> .. etc..
>>
>> firebug shows that the request on the wire is (as i would expect it to
>> be):
>> {"method":"people.get","params":{
>> *"userId":["@viewer"], "groupId":"@friends",
>> *
>> "fields":["id","name","thumbnailUrl","id","displayName"],"count":20,"sortBy":"topFriends","filterBy":"all"},"id":"viewerFriends"}
>>
>> However when I fire up a opensocial-0.8 using gadget that does:
>>   var req = opensocial.newDataRequest();
>>   var spec = opensocial.newIdSpec({"userId" : "VIEWER", "groupId" :
>> "FRIENDS"});
>>   var params = { "max" : 10};
>>   req.add(req.newFetchPeopleRequest(spec, params), "req_friends");
>>
>> firebug (and the crashing and burning php code) tells me the request is
>> now:
>>
>> {"method":"people.get","params":{
>> *
>> "userId":[{"fields_":{"userId":"VIEWER","groupId":"FRIENDS"}}],"groupId":"@self",
>> *
>> "fields":["id","name","thumbnailUrl","id","displayName"],"count":1000,"sortBy":"topFriends","filterBy":"all"},"id":"req_friends"}
>>
>> Now maybe i miss-read the json-rpc spec document, but that data format
>> doesn't look familiar to me ... an object with a fields_ property and in it
>> the userId and groupId? that can't be right, right?
>>
>> I'd like have this confirmed before i start butchering my code to
>> compensate for this oddity :)
>>
>>    -- Chris
>>
>>
>

Re: opensocial idspec confusing the out of me

Posted by Louis Ryan <lr...@google.com>.
This looks like a JSON conversion bug in the IdSpec object or in the
jsonrpccontainer. Ill take a look....

On Wed, Oct 8, 2008 at 10:09 AM, Chris Chabot <ch...@google.com> wrote:

> Hey Bob, Louis & shindig-dev,
>
> While testing the new social api i've commited today i've run into the
> strangest thing... depending on if a gadget uses the opensocial-0.7 or 0.8
> feature, the idSpec that it recieves is completely different in it's format
> ... And i can't seem to make sense out of it.
>
> See when I do this in a Require feature="opensocial-0.7" gadget:
> var req = opensocial.newDataRequest();
> req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS),
> 'viewerFriends');
> .. etc..
>
> firebug shows that the request on the wire is (as i would expect it to be):
> {"method":"people.get","params":{
> *"userId":["@viewer"], "groupId":"@friends",
> *
> "fields":["id","name","thumbnailUrl","id","displayName"],"count":20,"sortBy":"topFriends","filterBy":"all"},"id":"viewerFriends"}
>
> However when I fire up a opensocial-0.8 using gadget that does:
>   var req = opensocial.newDataRequest();
>   var spec = opensocial.newIdSpec({"userId" : "VIEWER", "groupId" :
> "FRIENDS"});
>   var params = { "max" : 10};
>   req.add(req.newFetchPeopleRequest(spec, params), "req_friends");
>
> firebug (and the crashing and burning php code) tells me the request is
> now:
>
> {"method":"people.get","params":{
> *
> "userId":[{"fields_":{"userId":"VIEWER","groupId":"FRIENDS"}}],"groupId":"@self",
> *
> "fields":["id","name","thumbnailUrl","id","displayName"],"count":1000,"sortBy":"topFriends","filterBy":"all"},"id":"req_friends"}
>
> Now maybe i miss-read the json-rpc spec document, but that data format
> doesn't look familiar to me ... an object with a fields_ property and in it
> the userId and groupId? that can't be right, right?
>
> I'd like have this confirmed before i start butchering my code to
> compensate for this oddity :)
>
>    -- Chris
>
>