Closed
Description
DESCRIPTION
When using EF OwnsOne/OwnsMany properties for nested or complex data structures/mappings JADNC 5 returns inconsistent results, nulls, or errors depending on use of include
or sparse fieldsets.
- For regular requests with no sparse fields and no includes, properties mapped with
OwnsOne
act as expected - When includes for other models are requested properties mapped with
OwnsOne
will return as null or invalid results - When using sparse fields on a resource with
OwnsOne
mappings, a tracking error is thrown.
STEPS TO REPRODUCE
Full reproduction project: https://github.com/rtablada/JsonApiDotnetExamples
EXPECTED BEHAVIOR
Attrs which expose properties from OwnsOne
should allow regular Attr
behavior and work with include
and fields
as any other exposed attribute
ACTUAL BEHAVIOR
OwnsOne
Attr
properties...
- return expected result with no complex query string
- return null when
include
operations are requested from query string - error when sparse fields are requested for
OwnsOne
attribute
VERSIONS USED
- JsonApiDotNetCore version: 5.1.2
- ASP.NET Core version: 7.0.0
- Entity Framework Core version: 7.0.4
- Database provider: PG for example project ☝🏽 (occurs with MSSQL as well)