microsoftgraph / microsoftgraph/msgraph-sdk-python
Inconsistent usage of 'select' OData system query option
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 630
- 分支
- 96
- 平均合併
- 15 小時 20 分鐘
- 30 天內合併 PR
- 3
描述
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
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
在 Developer Graph Explorer 中以及透過 Python msgraph SDK 重現該要求,重點關注 items 和 items/{id}/versions 端點。追蹤 SDK 如何序列化 OData 系統查詢選項,並將使用 '$select' 的要求與文件所述的行為進行比較。當有效的 list-items 和 versions 回應能夠與 '$select' 及 '$expand' 一起正常運作時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- api
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100