Patch created for evaluation
http://codereview.appspot.com/150052
I also updated the wiki with the patch contents
http://wiki.opensocial.org/index.php?title=Define_EL_access_to_meta-data_about_data-pipeline_tag_response
The short synopsis is root-level response meta information is accessed
via the "_response" key.
Ex: access totalResults via statement $
{friends._response.totalResults}
Originating request attributes may be accessed via "_request" key.
Ex: access requested count via statement ${friends._request.count}
For more options, visit this group at http://groups.google.com/group/opensocial-and-gadgets-spec?hl=en.--
You received this message because you are subscribed to the Google Groups "OpenSocial and Gadgets Specification Discussion" group.
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.
In the 0.9 spec we base EL statements on the "entry" key of the
response. This proposal isn't to re-base EL statements at the JSON
response root as that would lead to a cumbersome EL syntax. It's to
provide a reserved key that can expose the upper-level data (and
original request data) to EL statements without making the EL syntax
less natural.
The response in your example would actually have two "count"
equivalent values - the natural one coming off the array (aka
"length"), and the meta-data response value returned by the REST
endpoint. A clearer example would be to use "totalResults" since this
has no natural equivilent.
If we modify the proposal to use the upper case convention for the
reserved properties, the people request would work like this:
ex:
<os:PeopleRequest key="people" ... />
returning response
{
startIndex: 0,
count: 20,
totalResults: 143,
entry: [...]
}
(in 0.9)
${people[0].displayName} -> "John Doe"
${people.Response.totalResults} -> null/undefined at "Response" key
(in 1.0)
${people[0].displayName} -> "John Doe"
${people.Response.totalResults} -> 143
On Nov 10, 12:42 pm, Evan Gilbert <uid...@google.com> wrote:
> On Fri, Nov 6, 2009 at 2:38 PM, goosemanjack <cc...@myspace.com> wrote:
> > Patch created for evaluation
>
> >http://codereview.appspot.com/150052
>
> > I also updated the wiki with the patch contents
>
> >http://wiki.opensocial.org/index.php?title=Define_EL_access_to_meta-d...
> > opensocial-and-gadg...@googlegroups.com<opensocial-and-gadgets-spec%2Bunsu...@googlegroups.com>
To unsubscribe from this group, send email to opensocial-and-gadg...@googlegroups.com.
> ...
>
> read more »
I agree that the inversion of the REST structure (for meta data) when
being referenced within EL is less than ideal, but the alternative of
forcing the developer to constantly dig down into the entry key for
their 80% use cases would be worse. Remember that the developer can
still access the REST response in it's raw format by pulling the
object out of the client-side data context and accessing it through
JavaScript.
ex: <os:HttpRequest format="json" href="http://example.com/
mystuffpagedlist.svc?foo=x&bar=y&t=furry" key="external" />
yields data:
{
format: "furry",
items: [{object: "doll", type: "teddy bear"}, {object: "doll", type:
"kitty cat"}]
}
And EL statement:
You asked for ${external.format} items
Proposal as it stands evalutates:
${external.format} -> "furry"
${external.Request.format} -> "json"
Your proposed alternative:
${external.format} -> ?? "furry" | "json" (probably resolved with a
"last value set wins" situation)
The proposal as it stands would make it clear what the value of $
{external.format} should be by isolating the meta data away from the
data root. Your proposed alternative would be fine if we were only
dealing with one or two values, but we're dealing with multiple values
on both the Request and the Response, and these values could grow over
time.
Additionally, there is the concern about the synthetic Count variable
identified in the spec. On a <os:PeopleRequest> this results in two
"count" properties - one on the request and one on the response.
These might differ if, for example, 50 people are requested, but only
15 are available.
EX: <os:PeopleRequest key="pagedFriends" userId="@owner"
groupId="@friends" startIndex="51" count="50"/>
given the above only returns 15 results on the second page,
Proposal as it stands evalutates:
${pagedFriends.Count} -> 15
${external.Request.count} -> 50
Your proposed alternative:
${pagedFriends.Count} -> 15
${external.count} -> 50
Having two such similar variables at the root level will be a source
of confusion and bugs for developers.
--
clc
On Dec 18 2009, 5:41 pm, Evan Gilbert <uid...@google.com> wrote:
> On Fri, Dec 18, 2009 at 10:23 AM, goosemanjack <cc...@myspace.com> wrote:
> > I agree that the inversion of the REST structure (for meta data) when
> > being referenced within EL is less than ideal, but the alternative of
> > forcing the developer to constantly dig down into the entry key for
> > their 80% use cases would be worse. Remember that the developer can
> > still access the REST response in it's raw format by pulling the
> > object out of the client-side data context and accessing it through
> > JavaScript.
>
> I was suggesting another alternative - hosting the list but leaving the
> other parameters at the top level as well.
>
> Difference from your example in bold below:
>
> With response
> {
> startIndex: 0,
> count: 20,
> totalResults: 143,
> entry: [...]
>
> }
>
> (in 0.9)
> ${people[0].displayName} -> "John Doe"
> ${people.Response.totalResults} -> null/undefined at "Response" key
>
> (in 1.0)
> ${people[0].displayName} -> "John Doe"
> ${*people.totalResults*} -> 143
> ...
>
> read more »
On Jan 5, 6:10 pm, Evan Gilbert <uid...@google.com> wrote:
> I think we may be agreeing. The line in bold below (from your example) is
> the one I thought you didn't want to support:
>
> <quote>
>
> EX: <os:PeopleRequest key="pagedFriends" userId="@owner"
> groupId="@friends" startIndex="51" count="50"/>
>
> given the above only returns 15 results on the second page,
>
> Proposal as it stands evalutates:
> *${pagedFriends.Count} -> 15*
> ...
>
> read more »
What you've said is correct. The only thing under the "Response" key
is the meta-data about the response. They actual data ("entry" label)
and synthetics (currently, I think just Count, but there might be more
I'm missing) are at the top level.
From your example, I would say we get "length" at the root as a
natural value, and the "count" value will hold the same value, but be
attached to the Response.
<os:PeopleRequest key="people" groupId="@friends" />
${people.Request.count} -> undefined, in this case
${people.length} -> 20 (as a natural property of the array)
${people.Response.count} -> 20 (as part of the response meta data)
Is that acceptable, Evan? I only split hairs on the count item
because the value is already available in "length" and I'd rather not
be cherry-picking meta-data items to hoist without a compelling case.
--
clc
> ...
>
> read more »
http://codereview.appspot.com/150052
I've not added an explicit statement RE: hoisting count/length pending
your comments, Evan.
We could change the sample line to include an explicit example:
(now)
You requested ${friends.Request.count} records.
(could be)
You requested ${friends.Request.count} records and got $
{friends.length} back.
or
You requested ${friends.Request.count} records and got $
{friends.Count} back.
My preference would be for ${friends.length} since this is a natural
value (at least on the JavaScript side of the EL implementation).
--
clc
> ...
>
> read more »
OK. I think we're mostly in agreement. I tried to find the reference
to a synthetic "Count" variable being attached in the EL, but it must
have been in a very early version of the spec, because the text I'm
recalling is not to be found.
From your example, I would say we get "length" at the root as a
natural value, and the "count" value will hold the same value, but be
attached to the Response.
<os:PeopleRequest key="people" groupId="@friends" />
${people.Request.count} -> undefined, in this case
${people.length} -> 20 (as a natural property of the array)
${people.Response.count} -> 20 (as part of the response meta data)
Is that acceptable, Evan? I only split hairs on the count item
because the value is already available in "length" and I'd rather not
be cherry-picking meta-data items to hoist without a compelling case.
StartIndex
TotalResults
Count
As there are reserved values I'm assuming we should use the initial
Uppercase letter convention. I'll update the RC1 committed code with
this change.
--
clc
On Jan 12, 10:17 am, Lev Epshteyn <le...@google.com> wrote:
> +1 on keeping response data at the top level. Accessing this is the 95% use
> case, we shouldn't make it harder by forcing people to type 9 extra
> characters every time.
>
> The seeming symmetry between "Request" and "Response" doesn't hold up here,
> given the relative usage frequency of each. Response is by far the more
> important piece of that package, and should be easily accessible.
>
> On Tue, Jan 12, 2010 at 12:40 PM, Lane LiaBraaten <lliab...@google.com>wrote:
>
> > I agree with Evan...I see the benefit of 'result' having a "Request"
> > property, but I think the metadata about the response should remain as
> > properties of 'result' and not be put under 'result.Response'
>
> > This is currently in the spec draft (e.g.
> >http://www.opensocial.org/Technical-Resources/draft/Core-Data.xml#Col...),
> > but we don't have the 'Request' property documented. I guess we'd need to
> > add it here:
> >http://www.opensocial.org/Technical-Resources/draft/Core-Data.xml#rfc...
> ...
>
> read more »
> ...
>
> read more »
I'm going to completely nix the "Response" key as you propose, then
add a draft section under EL (7.4) that clearly identifies these as
reserved keys under the EL.
--
clc
> ...
>
> read more »
Modifying casing for EL meta-data access, addition of draft "reserved
properties" section for EL
FYI, the x:draft element causes the spec to no longer display in a
browser re: XML Parsing Error: prefix not bound to a namespace
--
clc
> ...
>
> read more »
I've committed a change to template spec:
Modifying casing for EL meta-data access, addition of draft "reserved
properties" section for EL
FYI, the x:draft element causes the spec to no longer display in a
browser re: XML Parsing Error: prefix not bound to a namespace
* Dynamic Parameters
* tag <os:ViewerRequest>
* tag <os:PeopleRequest>
* tag <os:OwnerRequest>
* tag <os:ActivitiesRequest>
I'll look over the other threads, but I don't recall any discussion on
the spec list of dropping these features.
--
clc
On Jan 13, 9:26 am, Lane LiaBraaten <lliab...@google.com> wrote:
> Hi Chris,
>
> Sorry I didn't catch this earlier, but patch 150052 and 143063 have changes
> to the OpenSocial-Data-Pipelining.xml file. The content of this file has
> been moved to Core-Gadget and Social-Gadget, though I think your changes
> apply only to Core-Gadget.xml (See the Data Pipelining section).
>
> Can you reapply the changes to Core-Gadget.xml? You can also go ahead and
> delete OpenSocial-Data-Pipelining.xml now that its content has been
> relocated.
>
> Sorry for the mixup,
> Lane
>
> http://codereview.appspot.com/
> <http://codereview.appspot.com/150052>150052<http://codereview.appspot.com/150052>
> ...
>
> read more »
from: reserved keys "TotalResults", "StartIndex", and "Count".
to: ...reserved keys "totalResults", "startIndex", and "count".
Patch updated:
http://codereview.appspot.com/150052
I can commit this, if that's appropriate. Also, the dynamic
parameters patch looks good.
On Jan 14, 7:46 am, Lane LiaBraaten <lliab...@google.com> wrote:
> I've got a patch for moving the Dynamic Parameters section:http://codereview.appspot.com/189069/show
>
> Please let me know if you find other content that needs to be added to
> Core-Gadget.xml (e.g. EL Statements?).
>
> The tags you mention are already in the Social-Gadget.xml spec:http://www.opensocial.org/Technical-Resources/draft/Social-Gadget.xml...
> ...
>
> read more »
Looks good.
On Jan 20, 2010 2:00 PM, "goosemanjack" <cc...@myspace.com> wrote:
I found a casing error in core-gadget. This patch changes from
Initial Upper to initial lower case as agreed to:
from: reserved keys "TotalResults", "StartIndex", and "Count".
to: ...reserved keys "totalResults", "startIndex", and "count".
Patch updated:
http://codereview.appspot.com/150052
I can commit this, if that's appropriate. Also, the dynamic
parameters patch looks good.
On Jan 14, 7:46 am, Lane LiaBraaten <lliab...@google.com> wrote:
> I've got a patch for moving the...
> The tags you mention are already in the Social-Gadget.xml spec:http://www.opensocial.org/Technical-Resources/draft/Social-Gadget.xml...
>
> Thanks,
> Lane
>
> On Wed, Jan 13, 2010 at 10:37 PM, goosemanjack <cc...@myspace.com> wrote:
> > I've applied 14306...
> ...
>
> read more »
--
You received this message because you are subscribed to the Google Groups...