[ 
https://issues.apache.org/jira/browse/OLINGO-1557?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bas van Meurs updated OLINGO-1557:
----------------------------------
    Description: 
OData specs on $it:

[http://docs.oasis-open.org/odata/odata/v4.0/os/part2-url-conventions/odata-v4.0-os-part2-url-conventions.html#_Toc372793854]

Shows the following example:

[http://host/service/Customers?$expand=Orders($filter=$it/Address/City] eq 
ShipTo/City)

*$it* from the $expand clause should refer to {*}Customers{*}, as stated in the 
specs.

But when using the Olingo server project, the following similar URL fails:

[http://localhost:8080/OData/V1.0/ResourceCollection?$expand=Resource_ResourcedepartmentCollection($filter=$it/ResourceClass%20gt%205)]

An exception is thrown by parsePropertyPathExpr in ExpressionParser.java:

{"error":\{"code":null,"message":"The property 'ResourceClass', used in a query 
expression, is not defined in type 'Planning.Resourcedepartment'."}}

This is failure *incorrect* AFAIK.

Analogous to the OData specs example, $it should refer to Resource 
(ResourceCollection's entity type), which does contain the ResourceClass 
column. The URL should thus be accepted.

For reference, some $metadata:

{{<EntityType Name="Resource">}}
{{<Key>}}
{{<PropertyRef Name="Id"/>}}
{{</Key>}}
{{<Property Name="Id" Type="Edm.Int32" Nullable="false">}}
{{<Annotation Qualifier="readonly">}}
{{<Bool>true</Bool>}}
{{</Annotation>}}
{{</Property>}}
{{<Property Name="ExternalId" Type="Edm.String" Nullable="false" 
MaxLength="255"/>}}
{{<Property Name="ResourceClass" Type="Edm.Int32" Nullable="false"/>}}
{{<Property Name="SortIndex" Type="Edm.Int32" Nullable="false"/>}}
{{<Property Name="Number" Type="Edm.String" Nullable="false" MaxLength="255"/>}}
{{<Property Name="Description" Type="Edm.String" Nullable="false" 
MaxLength="255"/>}}
{{<Property Name="Firstname" Type="Edm.String" Nullable="false" 
MaxLength="255"/>}}
{{<Property Name="LastnamePrefix" Type="Edm.String" Nullable="false" 
MaxLength="255"/> ...}}
{{ }}
{{<EntitySet Name="ResourceCollection" EntityType="Planning.Resource">}}
{{...}}
{{<NavigationPropertyBinding Path="Resource_ResourcedepartmentCollection" 
Target="ResourcedepartmentCollection"/>}}
{{{}...{}}}{{{}</EntitySet>{}}}

 

  was:
OData specs on $it:

[http://docs.oasis-open.org/odata/odata/v4.0/os/part2-url-conventions/odata-v4.0-os-part2-url-conventions.html#_Toc372793854]

Shows the following example:

[http://host/service/Customers?$expand=Orders($filter=$it/Address/City] eq 
ShipTo/City)

*$it* from the $expand clause should refer to {*}Customers{*}, as stated in the 
specs.

But when using the Olingo server project, the following similar URL fails:

[http://localhost:8080/OData/V1.0/ResourceCollection?$expand=Resource_ResourcedepartmentCollection($filter=$it/ResourceClass%20gt%205)]

An exception is thrown by parsePropertyPathExpr in ExpressionParser.java:

{"error":\{"code":null,"message":"The property 'ResourceClass', used in a query 
expression, is not defined in type 'Planning.Resourcedepartment'."}}

This is failure *incorrect* AFAIK.

Analogous to the OData specs example, $it should refer to Resource 
(ResourceCollection's entity type), which does contain the ResourceClass 
column. The URL should thus be accepted.

For reference, some $metadata:

{{{{{}<EntityType Name="Resource">{}}}{{{{}}{}}}}}
{{<Key>}}
{{<PropertyRef Name="Id"/>}}
{{</Key>}}
{{<Property Name="Id" Type="Edm.Int32" Nullable="false">}}
{{<Annotation Qualifier="readonly">}}
{{<Bool>true</Bool>}}
{{</Annotation>}}
{{</Property>}}
{{<Property Name="ExternalId" Type="Edm.String" Nullable="false" 
MaxLength="255"/>}}
{{<Property Name="ResourceClass" Type="Edm.Int32" Nullable="false"/>}}
{{<Property Name="SortIndex" Type="Edm.Int32" Nullable="false"/>}}
{{<Property Name="Number" Type="Edm.String" Nullable="false" MaxLength="255"/>}}
{{<Property Name="Description" Type="Edm.String" Nullable="false" 
MaxLength="255"/>}}
{{<Property Name="Firstname" Type="Edm.String" Nullable="false" 
MaxLength="255"/>}}
{{<Property Name="LastnamePrefix" Type="Edm.String" Nullable="false" 
MaxLength="255"/> ...}}
{{ }}
{{{{{}<EntitySet Name="ResourceCollection" 
EntityType="Planning.Resource">{}}}{{{{}}{}}}}}
{{...}}
{{<NavigationPropertyBinding Path="Resource_ResourcedepartmentCollection" 
Target="ResourcedepartmentCollection"/>}}
{{{{{{}}{}}}{{{}...{}}}{{{}</EntitySet>{}}}}}

 


> $it refers to the wrong entitytype
> ----------------------------------
>
>                 Key: OLINGO-1557
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1557
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-server
>    Affects Versions: (Java) V4 4.8.0
>            Reporter: Bas van Meurs
>            Priority: Major
>
> OData specs on $it:
> [http://docs.oasis-open.org/odata/odata/v4.0/os/part2-url-conventions/odata-v4.0-os-part2-url-conventions.html#_Toc372793854]
> Shows the following example:
> [http://host/service/Customers?$expand=Orders($filter=$it/Address/City] eq 
> ShipTo/City)
> *$it* from the $expand clause should refer to {*}Customers{*}, as stated in 
> the specs.
> But when using the Olingo server project, the following similar URL fails:
> [http://localhost:8080/OData/V1.0/ResourceCollection?$expand=Resource_ResourcedepartmentCollection($filter=$it/ResourceClass%20gt%205)]
> An exception is thrown by parsePropertyPathExpr in ExpressionParser.java:
> {"error":\{"code":null,"message":"The property 'ResourceClass', used in a 
> query expression, is not defined in type 'Planning.Resourcedepartment'."}}
> This is failure *incorrect* AFAIK.
> Analogous to the OData specs example, $it should refer to Resource 
> (ResourceCollection's entity type), which does contain the ResourceClass 
> column. The URL should thus be accepted.
> For reference, some $metadata:
> {{<EntityType Name="Resource">}}
> {{<Key>}}
> {{<PropertyRef Name="Id"/>}}
> {{</Key>}}
> {{<Property Name="Id" Type="Edm.Int32" Nullable="false">}}
> {{<Annotation Qualifier="readonly">}}
> {{<Bool>true</Bool>}}
> {{</Annotation>}}
> {{</Property>}}
> {{<Property Name="ExternalId" Type="Edm.String" Nullable="false" 
> MaxLength="255"/>}}
> {{<Property Name="ResourceClass" Type="Edm.Int32" Nullable="false"/>}}
> {{<Property Name="SortIndex" Type="Edm.Int32" Nullable="false"/>}}
> {{<Property Name="Number" Type="Edm.String" Nullable="false" 
> MaxLength="255"/>}}
> {{<Property Name="Description" Type="Edm.String" Nullable="false" 
> MaxLength="255"/>}}
> {{<Property Name="Firstname" Type="Edm.String" Nullable="false" 
> MaxLength="255"/>}}
> {{<Property Name="LastnamePrefix" Type="Edm.String" Nullable="false" 
> MaxLength="255"/> ...}}
> {{ }}
> {{<EntitySet Name="ResourceCollection" EntityType="Planning.Resource">}}
> {{...}}
> {{<NavigationPropertyBinding Path="Resource_ResourcedepartmentCollection" 
> Target="ResourcedepartmentCollection"/>}}
> {{{}...{}}}{{{}</EntitySet>{}}}
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to