Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selecting properties in a nested complex type does not work #989

Closed
ificator opened this issue Jun 6, 2017 · 6 comments
Closed

Selecting properties in a nested complex type does not work #989

ificator opened this issue Jun 6, 2017 · 6 comments
Labels

Comments

@ificator
Copy link
Contributor

ificator commented Jun 6, 2017

Say I have a model where a Inner complex type is nested within an Outer complex (or entity) type, so a request without a $select would return:

{
  "outerProperty1": "foo",
  "outerProperty2": "bah",
  "inner": {
    "innerProperty1": "foo",
    "innerProperty2": "bah"
  }
}

According to the OData spec I should be able to write a query like ...?$select=outerProperty1,inner/innerProperty2 and have it return:

{
  "outerProperty1": "foo",
  "inner": {
    "innerProperty2": "bah"
  }
}

However what we actually get is an ODataException with message:

A path within the select or expand query option is not supported.

Assemblies affected

System.Web.OData

Reproduce steps

  1. Make a request against a resource with a complex type property, and include a $select statement that references just one of the properties within that complex type.

Expected result

The request succeeds, and only the requested property from the complex type is returned.

Actual result

The request fails.

Additional details

Issue #837 mentions this issue, but it seems prudent to track it specifically.

@xuzhg
Copy link
Member

xuzhg commented Jun 8, 2017

BingAds has this requirement.

@daspek
Copy link

daspek commented Jun 9, 2017

Further, we need a compact syntax to represent this. Let's say we have this object:

{
  "outerProperty": "foo",
  "innerProperty": {
    "inner1": "foo",
    "inner2": "bah",
    "inner3": "baz",
    "inner4": "qux"
  }
}

We don't want to do $select=innerProperty/inner1,innerProperty/inner2,innerProperty/inner3.
Instead, it should look like nested expand syntax: $select=innerProperty($select=inner1,inner2,inner3)

@xuzhg xuzhg added the P2 label Jun 9, 2017
@brjohnstmsft
Copy link
Contributor

@xuzhg Azure Search also has this requirement.

This seems to be a duplicate of #196 which as been open for a very long time. Any chance there will be traction on this soon?

FYI @robward-ms

@brjohnstmsft
Copy link
Contributor

Also related: OData/odata.net#513

@ificator
Copy link
Contributor Author

It would also be nice if there was a capability of filtering collection properties that aren't navigations:

$select=collectionProperty($filter=name%20eq%20'foo')

@brjohnstmsft
Copy link
Contributor

@xuzhg I propose closing this issue since it is a duplicate of #196. If you agree, please close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants