OData / OData/odataorg.github.io

Reference service OData lambda queries don't work

Open
#374 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
73
Forks
106
PR merge metrics
No merged PRs in 30d

Description

Hello,

I’m trying to use OData reference service with OData ‘any’ function and getting errors consistently.

These examples

http://services.odata.org/TripPinRESTierService/(S(3mslpb2bc0k5ufk24olpghzx))/People?$filter=AddressInfo/any(o:o/Address eq '87 Polk St. Suite 5')
http://services.odata.org/TripPinRESTierService/(S(3mslpb2bc0k5ufk24olpghzx))/People?$filter=Emails/any(o:o eq 'Russell@contoso.com')

produce

{
    "error": {
        "code": "",
        "message": "Value cannot be null.\r\nParameter name: source"
    }
}

I cannot check if the collection itself is null

http://services.odata.org/TripPinRESTierService/(S(3mslpb2bc0k5ufk24olpghzx))/People?$filter=Emails ne null

{
    "error": {
        "code": "",
        "message": "The operand for a binary operator 'NotEqual' is not a single value. Binary operators require both operands to be single values."
    }
}

If I use the lamda query from the collection
http://services.odata.org/TripPinRESTierService/(S(3mslpb2bc0k5ufk24olpghzx))/Me/Friends?$filter=Friends/any(f:f/FirstName eq 'Scott')

it doesn’t return an error, however it doesn’t seem to work correctly since none of the results have string “Scott” in them

{
    "@odata.context": "https://services.odata.org/TripPinRESTierService/(S(3mslpb2bc0k5ufk24olpghzx))/$metadata#People",
    "value": [
        {
            "UserName": "russellwhyte",
            "FirstName": "Russell",
            "LastName": "Whyte",
            "MiddleName": null,
            "Gender": "Male",
            "Age": null,
            "Emails": [
                "Russell@example.com",
                "Russell@contoso.com"
            ],
            "FavoriteFeature": "Feature1",
            "Features": [
                "Feature1",
                "Feature2"
            ],
            "AddressInfo": [
                {
                    "Address": "187 Suffolk Ln.",
                    "City": {
                        "Name": "Boise",
                        "CountryRegion": "United States",
                        "Region": "ID"
                    }
                }
            ],
            "HomeAddress": null
        },
        {
            "UserName": "ronaldmundy",
            "FirstName": "Ronald",
            "LastName": "Mundy",
            "MiddleName": null,
            "Gender": "Male",
            "Age": null,
            "Emails": [
                "Ronald@example.com",
                "Ronald@contoso.com"
            ],
            "FavoriteFeature": "Feature1",
            "Features": [],
            "AddressInfo": [
                {
                    "Address": "187 Suffolk Ln.",
                    "City": {
                        "Name": "Boise",
                        "CountryRegion": "United States",
                        "Region": "ID"
                    }
                }
            ],
            "HomeAddress": null
        }
    ]
}


Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the three reported queries against the TripPinRESTierService URLs, especially the collection lambda filters and the Emails null comparison. Trace the reference service's OData lambda-query handling; done means the examples return correct filtered results or clear, valid errors instead of null-source failures.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.