You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I wanted to use Microsoft.OData.UriParser.ODataUriParser to parse a URL in which the $root literal was used.
The OData 4.01 specification states the following:
5.1.1.14.5 [$root](https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_root)
The $root literal can be used in expressions to refer to resources of the same service. It can be used as a single-valued expression or within [complex or collection literals](https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_ComplexandCollectionLiterals).
Example 108: all employees with the same last name as employee A1235
http://host/service/Employees?$filter=LastName eq $root/Employees('A1245')/LastName
Example 109: products ordered by a set of customers, where the set of customers is passed as a JSON array containing the resource paths from $root to each customer.
http://host/service/ProductsOrderedBy(Customers=@c)?@c=[$root/Customers('ALFKI'),$root/Customers('BLAUS')]
However, if I used the parser on the example from the specification ( http://host/service/Employees?$filter=LastName eq $root/Employees('A1245')/LastName ), the parser would return the error "Could not find a property named '$root' on type 'Employees'."
I don't know if I'm doing something wrong, or if this literal is not implemented.
And if it's not implemented, I'd like to ask if that's in the plans. Alternatively, if it is possible to solve it somehow at the moment.
The text was updated successfully, but these errors were encountered:
5.1.1.14.5 $root
The $root literal can be used in expressions to refer to resources of the same service. It can be used as a single-valued expression or within complex or collection literals.
Example 108: all employees with the same last name as employee A1235
http://host/service/Employees?$filter=LastName eq $root/Employees('A1245')/LastName
Example 109: products ordered by a set of customers, where the set of customers is passed as a JSON array containing the resource paths from $root to each customer.
http://host/service/ProductsOrderedBy(Customers=@c)?@c=[$root/Customers('ALFKI'),$root/Customers('BLAUS')]
Hello,
I wanted to use Microsoft.OData.UriParser.ODataUriParser to parse a URL in which the $root literal was used.
The OData 4.01 specification states the following:
However, if I used the parser on the example from the specification (
http://host/service/Employees?$filter=LastName eq $root/Employees('A1245')/LastName
), the parser would return the error "Could not find a property named '$root' on type 'Employees'."I don't know if I'm doing something wrong, or if this literal is not implemented.
And if it's not implemented, I'd like to ask if that's in the plans. Alternatively, if it is possible to solve it somehow at the moment.
The text was updated successfully, but these errors were encountered: