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

Reading non-resource in a resource set throw exception #907

Closed
xuzhg opened this issue May 3, 2023 · 0 comments · Fixed by #905
Closed

Reading non-resource in a resource set throw exception #907

xuzhg opened this issue May 3, 2023 · 0 comments · Fixed by #905
Labels
bug Something isn't working

Comments

@xuzhg
Copy link
Member

xuzhg commented May 3, 2023

Assemblies affected
Which assemblies and versions are known to be affected e.g. ASP.NET Core OData 8.x

Suppose I have the following request payload (ODL supports reading the following dynamic property)

{
    "Name": "Sam",
    "ADynamicProperty": [
         42,
         "a string value",
         { "key1":"value1"}
   ] 
}

ODL can read the above dynamic property "ADynamicProperty".
It returns the following reader state:

ResourceStart (top-Level)
  NestedResourceInfoStart (ADynamicProperty)
     ResourceSetStart
           Primitive (42)
           Primitive (a string value)
           ResourceStart
           ResourceEnd
     ResourceSetEnd
  NestedResourceInfoEnd
ResourceEnd

Expected behavior

ASP.NET Core can handle the above scenario, it means it can handle the 'Primitive' reader state.

Actual behavior

There's no logic to handle 'Primitive' reader state.

@xuzhg xuzhg added the bug Something isn't working label May 3, 2023
@xuzhg xuzhg closed this as completed in #905 May 3, 2023
xuzhg added a commit that referenced this issue May 3, 2023
* Part of Issue #885: Enable read the untyped collection

* Update src/Microsoft.AspNetCore.OData/Formatter/Wrapper/ODataReaderExtensions.cs

Co-authored-by: Clément Habinshuti <clhabins@microsoft.com>

* rename the variable name

* We consider the order does matter, let's save items in 'Resources' to 'Items' also to keep it same order

---------

Co-authored-by: Clément Habinshuti <clhabins@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant