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

Failure when parsing OData function with $expand AND $filter #1667

Open
ksikorsk opened this issue Feb 19, 2020 · 5 comments
Open

Failure when parsing OData function with $expand AND $filter #1667

ksikorsk opened this issue Feb 19, 2020 · 5 comments
Assignees

Comments

@ksikorsk
Copy link

Exception thrown when parsing a URI for a OData Function with $expand and $filter statemenets.
I.E. ~/messages/delta?$expand=singleValueExtendedProperties($filter=id eq 'value')

where delta is a function that returns a collection:

<EntityType Name="mailFolder" BaseType="graph.entity">
  <NavigationProperty Name="messages" Type="Collection(graph.message)" ContainsTarget="true"/>
</EntityType>
<EntityType Name="message" BaseType="graph.outlookItem" OpenType="true">
  <NavigationProperty Name="singleValueExtendedProperties" Type="Collection(graph.singleValueLegacyExtendedProperty)" ContainsTarget="true"/>
  <NavigationProperty Name="multiValueExtendedProperties" Type="Collection(graph.multiValueLegacyExtendedProperty)" ContainsTarget="true"/>
</EntityType>
<EntityType Name="singleValueLegacyExtendedProperty" BaseType="graph.entity">
  <Property Name="value" Type="Edm.String"/>
</EntityType>
<Function Name="delta" IsBound="true">
  <Parameter Name="bindingparameter" Type="Collection(Microsoft.OutlookServices.message)" />
  <ReturnType Type="Collection(Microsoft.OutlookServices.message)" Nullable="false" />
</Function>

Assemblies affected

OData .Net lib 7.6.3

Reproduce steps

GET https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messages/delta?$expand=singleValueExtendedProperties($filter=id eq 'value')

Expected result

The URI to be parsed and sent over to workload.

Actual result

AGS fails when parsing the URI, and the workload is never reached.

Exception:

System.ArgumentNullException: Value cannot be null.
Parameter name: initialState
   at Microsoft.OData.ExceptionUtils.CheckArgumentNotNull[T](T value, String parameterName)
   at Microsoft.OData.UriParser.MetadataBinder..ctor(BindingState initialState)
   at Microsoft.OData.UriParser.SelectExpandBinder.BindFilter(QueryToken filterToken, IEdmNavigationSource navigationSource, IEdmTypeReference elementType, HashSet`1 generatedProperties, Boolean collapsed)
   at Microsoft.OData.UriParser.SelectExpandBinder.GenerateExpandItem(ExpandTermToken tokenIn)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at Microsoft.OData.UriParser.SelectExpandBinder.Bind(ExpandToken expandToken, SelectToken selectToken)
   at Microsoft.OData.UriParser.SelectExpandSemanticBinder.Bind(ODataPathInfo odataPathInfo, ExpandToken expandToken, SelectToken selectToken, ODataUriParserConfiguration configuration, BindingState state)
   at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseSelectAndExpandImplementation(String select, String expand, ODataUriParserConfiguration configuration, ODataPathInfo odataPathInfo)
   at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseSelectAndExpand()
   at Microsoft.Online.AggregatorService.Controller.ParserEngine.ParseAndExpand(RequestContext context, ODataUriParser parser, ParsedRequestState state) in C:\Dev\AGS-AggregatorService\src\dev\Controller\Parser\ParserEngine.cs:line 1294

Additional info

Note: that this works when being applied directly on the entity collection or without the $filter clause. I.E. the following requests work (forward the request to the exchange workload):

@Sreejithpin
Copy link
Contributor

Thanks for raising this. We will be investigating and will connect with you on this

@odero
Copy link

odero commented Feb 26, 2020

Related #1162

@xuzhg xuzhg assigned gathogojr and unassigned KanishManuja-MS Jul 21, 2020
@iriszhou320
Copy link

@gathogojr hey we have encountered the same issue, where expanding singleExtendedProperties is not supported using delta, but this is a key feature for our implementation. any progress on it?

@ksikorsk
Copy link
Author

There is a suggested mitigation here: #1162

@iriszhou320
Copy link

@ksikorsk yes thanks for the ping! still a bit confused how we can add the entitySetPath to the step of just simply calling the url? like GET https://graph.microsoft.com/v1.0/me/drive/root/delta?$expand=microsoft.graph.driveItem/children($filter=id eq ‘x’)

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

No branches or pull requests

6 participants