Open Supernectar opened 1 year ago
This seems to be related to this: https://github.com/OData/AspNetCoreOData/issues/1056 too. There is an open issue in the Cosmos SDK repo https://github.com/Azure/azure-cosmos-dotnet-v3/issues/4096 that we are currently following up with.
Is there a status update on this? This would be very useful to be fixed
Assemblies affected ASP.NET Core OData 8.2.3 and Microsoft.Azure.Cosmos 3.35.4
Describe the bug Using the ODataQueryOptions.ApplyTo Method with the Container.GetItemLinqQueryable Method throws an exception only, and only if the user provides a $select option in the url. Any other option such as $top, $skip, $filter work fine. Only when using $select the exception is thrown.
Reproduce steps
Clone this repo https://github.com/Supernectar/ODataCosmosDBSelectBug.git
Run the web app
Make a GET request to any of these urls:
See the exception being returned
NOTE: You need to have a cosmosDB emulator running with a database named "TestDB" and a container named "test". Ideally this container should contain some sample data:
Data Model This is the main class where the exception is being generated:
You can check the rest of the code more in details in this example repo https://github.com/Supernectar/ODataCosmosDBSelectBug.git
Request/Response When doing a GET request to any of these urls
Expected behavior I want to be able to use the $select option properly. Given the example data provided above, if I do a GET request to this url https://localhost:7234/customers?$select=orders/amount I want to receive the following data in the response body: