Missing the specifications for metadata information for Collections data type for JSON-RPC and REST endpoints

19 views
Skip to first unread message

Henry Saputra

unread,
Jun 20, 2012, 2:14:35 AM6/20/12
to opensocial-an...@googlegroups.com
I think we are missing formal construct of the Collection metadata
information: filtered ( "true" / "false" ) , "updatedSince ( "true" /
"false" ), and sorted ( "true" / "false" ) that describes whether the
requests params for collection of data is supported for both JSON-RPC
and REST endpoints.

There are 2 places I saw mention this:
http://opensocial-resources.googlecode.com/svn/spec/trunk/Core-Data.xml#ActivityStreamsCollection
and http://opensocial-resources.googlecode.com/svn/spec/trunk/Core-API-Server.xml#rfc.section.6.2.7

The specs basically said that IF the container does not support
filter, updatedSince, or sort request params then response MUST return
false for those type of properties.
This behavior actually contradicts the XML schema for REST response
and kinda hard to check using JavaScript.

Imagine that we have this code:

var params = {
userId: "@me",
groupId: "@self",
fields: "@all",
count: 10
};
osapi.activitystreams.get(params).execute(function(result) {
if(result.filtered) {

// DO STUFF
}
});

The check for "if(result.filtered)" could return false for either the
result object have "filtered" property sets to false or its undefined,
which suppose to mean that it support filtered request parameter.
Hence the code to check if result.filtered exist should do look like
if(!result.hasOwnProperty()) or if(typeof result.filtered !==
"undefined") which neither are good.

I recommend we REQUIRED collection data type to be accompanied by the
metadata about its supported behavior all the times to make the spec
more strict and easier for programmers to code against it.

- Henry

Matthew Marum

unread,
Jun 20, 2012, 2:02:37 PM6/20/12
to opensocial-an...@googlegroups.com
+1 that.  Could you create an issue?

Matt

Henry Saputra

unread,
Jun 20, 2012, 2:56:17 PM6/20/12
to opensocial-an...@googlegroups.com
Issue 1323 is filed:

http://code.google.com/p/opensocial-resources/issues/detail?id=1323


- Henry
> --
> You received this message because you are subscribed to the Google Groups
> "OpenSocial and Gadgets Specification Discussion" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/opensocial-and-gadgets-spec/-/pIh3qC9ju9AJ.
> To post to this group, send email to
> opensocial-an...@googlegroups.com.
> To unsubscribe from this group, send email to
> opensocial-and-gadg...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/opensocial-and-gadgets-spec?hl=en.

Henry Saputra

unread,
Jul 5, 2012, 4:52:09 PM7/5/12
to opensocial-an...@googlegroups.com
Patch attached to the issue. Review is welcomed and encouraged.

- Henry

Henry Saputra

unread,
Jul 10, 2012, 11:51:43 AM7/10/12
to opensocial-an...@googlegroups.com
Ping for review please

On Wed, Jun 20, 2012 at 11:56 AM, Henry Saputra <henry....@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages