OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

odata message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [OASIS Issue Tracker] (ODATA-1109) Clarify that 'parameter' aliases can also be used to substitute expressions


    [ https://issues.oasis-open.org/browse/ODATA-1109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=67471#comment-67471 ] 

Michael Pizzo edited comment on ODATA-1109 at 9/14/17 4:25 PM:
---------------------------------------------------------------

Even without passing expressions to functions, we have the problem:

    Me?$expand=Friends($filter=BestFriend/Gender eq @p1)&@p1=Gender 

Does this return all of my friends whose best friend is the same gender as I am, or all of my friends whose best friend is the same gender as they are?

I would have expected that Gender be evaluated in the context of Me, since I am the topic of the current URL path segment.

Similarly for:

    People?$expand=Friends($filter=BestFriend/Gender eq @p1)&@p1=Gender 

Does that find the friends for each person whose best friend is the same gender as the person, or the person's friend?

In either case, the expression is not circular because it is being evaluated within the context of the same URL path segment.  The circular references come in when the path segment where the alias is used is not the last path segment of the URL.

If we say that the alias is evaluated relative to the URL path segment (not to be confused with the expression path segment) in which it is used, then the first statement would be evaluated in the context of Me, while a function within the path would be evaluated within the context of that function, i.e., conceptually:

Customers(ID=42)/some.function(par1=@p);@p=FirstName/BestFriend 

Thoughts?

Note that, no matter what, it makes sense for the *expression* "ID gt 1" to be passed into the $filter segment in:

 /Customers/$filter=@f/some.Function()?@ID gt 1

Because the type of parameter for a $filter URL segment is an expression.

Similarly, we could ask for all Orders that were shipped to a customers home city:
>Customers?$expand=Orders($filter=ShipTo/City eq @p1))&@p1=HomeAddress/City

Which would be equivalent to:
>Customers?$expand=Orders($filter=ShipTo/City eq $it/HomeAddress/City)

If we extended the syntax to allow parameters in the expand options, we could do:
>Customers?$expand=Orders($filter=ShipTo/City eq @p1;@p1=ShipFrom/City)



was (Author: mikep):
Even without passing expressions to functions, we have the problem:

    Me?$expand=Friends($filter=BestFriend/Gender eq @p1))&@p1=Gender 

Does this return all of my friends whose best friend is the same gender as I am, or all of my friends whose best friend is the same gender as they are?

I would have expected that Gender be evaluated in the context of Me, since I am the topic of the current URL path segment.

Similarly for:

    People?$expand=Friends($filter=BestFriend/Gender eq @p1))&@p1=Gender 

Does that find the friends for each person whose best friend is the same gender as the person, or the person's friend?

In either case, the expression is not circular because it is being evaluated within the context of the same URL path segment.  The circular references come in when the path segment where the alias is used is not the last path segment of the URL.

If we say that the alias is evaluated relative to the URL path segment (not to be confused with the expression path segment) in which it is used, then the first statement would be evaluated in the context of Me, while a function within the path would be evaluated within the context of that function, i.e., conceptually:

Customers(ID=42)/some.function(par1=@p);@p=FirstName/BestFriend 

Thoughts?

Note that, no matter what, it makes sense for the *expression* "ID gt 1" to be passed into the $filter segment in:

 /Customers/$filter=@f/some.Function()?@ID gt 1

Because the type of parameter for a $filter URL segment is an expression.

> Clarify that 'parameter' aliases can also be used to substitute expressions
> ---------------------------------------------------------------------------
>
>                 Key: ODATA-1109
>                 URL: https://issues.oasis-open.org/browse/ODATA-1109
>             Project: OASIS Open Data Protocol (OData) TC
>          Issue Type: Bug
>          Components: Protocol
>    Affects Versions: V4.01_CSD02
>         Environment: [Proposed]
>            Reporter: Hubert Heijkers
>             Fix For: V4.01_CS01
>
>
> 11.2.6.1.3 Parameter Aliases specifies that "Parameter aliases allow the same value to be used multiple times in a request and may be used to reference primitive values, complex, or collection values" yet in both Example 67 and Example 79 we ourselves show that aliases can also be used to substitute expressions, something which my developers deem is against what's been specified in 11.2.6.1.3, hence the ask for clarification.



--
This message was sent by Atlassian JIRA
(v6.2.2#6258)


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]