-
Type: Improvement
-
Status: Closed
-
Priority: Minor
-
Resolution: Duplicate
-
Affects Version/s: V4.0_CS02
-
Fix Version/s: V4.01_WD01
-
Component/s: URL Conventions
-
Labels:
-
Environment:
Complex Types
-
Proposal:
-
Resolution:
In ODATA-400 we decided to allow JSON arrays and objects as common expressions, and the example uses the eq operators to compare an entity with a JSON-represented entity reference. The ABNF supports this, and it would be useful to use objects and arrays for eq, ne comparisons, but [URL Conventions] appears to have leftover wording that prohibits the use of collection, entity, or complex types in any logical operators.
5.1.1.1Logical Operators
OData defines a set of logical operators that evaluate to true or false (i.e. a boolCommonExpr as defined in [OData-ABNF]). Logical operators are typically used to filter a collection of resources.
Operands of collection, entity, and complex types are not supported in logical operators.
The syntax rules for the logical operators are defined in [OData-ABNF].
The six comparison operators can be used with all primitive values except Edm.Binary, Edm.Stream, and the Edm.Geo types.
This prevents expression of a request such as:
~odata.svc/Suppliers?$filter=Address ne
{"Street": "NE 40th", "City": "Redmond", "State": "WA", "ZipCode": "98052", "Country": "USA"}requiring instead:
~odata.svc/Suppliers?$filter=Address.Street ne "NE 40th" or Address.City ne "Redmond" or Address.State ne "WA" or Address.ZipCode ne "98052" or Address. Country ne "USA"
Services that follow the ABNF and other examples may already support this in 4.0, and would be compliant in doing so, but we should remove the offending statement in 4.1.