microsoftgraph / microsoftgraph/msgraph-sdk-python
Inconsistent usage of 'select' OData system query option
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 630
- Forks
- 96
- Avg merge
- 15h 20m
- Merged PRs (30d)
- 3
Description
Describe the bug
When I query the SharePoint API using 'expand' and 'select' query options, the API expects 'select' and not '$select'.
This is not a huge problem as I can easily change my query params to use 'select', however we cannot use the Python msgraph SDK as it always converts the special system query options with a $ prepended.
To Reproduce
Steps to reproduce the behavior:
- Using the Developer Graph Explorer run a query similar to this:
/items$expand=fields&$select=fields/status,lastModifiedDateTime,id
- See error:
{ "error": { "code": "BadRequest", "message": "Parsing OData Select and Expand failed: Found a path with multiple navigation properties or a bad complex property path in a select clause. Please reword your query such that each level of select or expand only contains either TypeSegments or Properties.", "innerError": { "date": "2024-04-09T18:29:12", "request-id": "60cb4f4b-e5f4-48ee-8f1c-981e88440310", "client-request-id": "ed396593-a29f-0d6b-d2d7-d8dc632e4edc" } } }
Workaround
4.Change the '$select' query param to 'select' (without the dollar sign) and you get a valid response.
/items$expand=fields&select=fields/status,lastModifiedDateTime,id
Expected behavior
A valid listitems response from the API using $select
Additional context
This also happens on the items/{id}/versions endpoint
Documentation for OData query options indicates $select as the query param:
https://learn.microsoft.com/en-us/odata/concepts/queryoptions-overview
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the request in Developer Graph Explorer and through the Python msgraph SDK, focusing on the items and items/{id}/versions endpoints. Trace how the SDK serializes OData system query options and compare requests using '$select' with the documented behavior. Done means valid list-items and version responses work with '$select' alongside '$expand'.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100