Skip to content

$expand Contains Incorrect Context Link #883

@alexleen

Description

@alexleen

Observed in System.Web.OData 5.9.1 & 6.0.0

I have exposed the the following endpoint:

/entity1('key')/entity2('key')/entity3('key')/entity4('key')

When I execute /entity1('key')/entity2('key')/entity3?$expand=entity4 I receive a JSON response with the correct "@odata.context":

"@odata.context": "https://host:port/$metadata#entity1('key')/entity2('ket')/entity3",
 "value": [
{
  ...,
  "[email protected]": "https://host:port/$metadata#entity1('key')/entity2('key')/entity3('key')/entity4",
  "entity4": [
    {
      ...
    }
  ]
},
...

When I execute /entity1('key')/entity2('key')/entity3('key')?$expand=entity4 however, I receive an incorrect "@odata.context" with two keys:

"@odata.context": "https://host:port/$metadata#entity1('key')/entity2('ket')/entity3",
 "value": [
{
  ...,
  "[email protected]": "https://host:port/$metadata#entity1('key')/entity2('key')/entity3('key')('key')/entity4",
  "entity4": [
    {
      ...
    }
  ]
}

This causes an exception when executing with Microsoft's OData Client:

"The context URL 'https://host:port/$metadata#entity1('key')/entity2('key')/entity3('key')('key')/entity4' is invalid."

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions