Auto expand doesn't work for the nested expanded entities using $expand
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
When applying the AutomaticallyExpand or [AutoExpand] for a navigation property, the expected behavior is to expand it automatically. It works when getting the entity from root level, but it doesn't work if the entity is expanded by a $expand clause.
The previous ODATA version I used was 5.11.0 and it worked normally. But after upgrading to the version 8, it doesn't work anymore.
public class Book
{
public int Id {get; set; }
public Author Author{get;set;}
}
public class Author
{
public int Id{get;set;}
[AutoExpand]
public IList<Address> Addresses{get;set;}
}
public class Address
{
public int Id{get;set;}
public string Address{get;set;}
}
...
GET /odata/Authors
Successfully expands the Addresses of the Authors.
GET /odata/Books?$expand=Author
Doesn't expand the Addresses of the Book/Author.
Contributor guide
No contributing guide indexed for this repository
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
Start by reproducing the two requests shown in the issue with the Book, Author, and Address models on ASP.NET Core OData 8, comparing root-level expansion with nested $expand=Author behavior. Trace the AutoExpand handling for the nested navigation property; done means GET /odata/Books?$expand=Author also includes Author.Addresses as the root Authors request does.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100