Derived Class Does Not Show odata.type
@xuzhg is already working on this.
Since Oct 24, 2023.
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
Short summary (3-5 sentences) describing the issue.
I have an entity that has a property, and that property is a complex type. When I return a derived class from the abstract complex type the @odata.type is not returned. This causes issues when I am trying to use graph.microsoft.com because graph can't determine it is the derived class.
Assemblies affected
Which assemblies and versions are known to be affected e.g. OData .Net lib 7.x
.NET 7
Microsoft.AspNetCore.OData v8.2.0
Microsoft.OData.Core v 7.16
Reproduce steps
Use repo https://github.com/OData/odata.net/files/13048351/WebApplication3.zip (from OData/odata.net#2774)
Run it and send request: http://localhost:5197/odata/IdentityGovernance/PermissionsAnalytics/Findings/%7Bkey%7D/WebApplication3.Models.ExternallyFinding/AccountsWithAccess
Expected result
{
"@odata.context": "http://localhost:5197/odata/$metadata#identityGovernance/PermissionsAnalytics/Findings('key')/WebApplication3.Models.ExternallyFinding/AccountsWithAccess(WebApplication3.Models.EnumeratedAccountsWithAccess/Accounts())",
"@odata.type": "#WebApplication3.Models.EnumeratedAccountsWithAccess",
"Accounts": [
{
"@odata.type": "#WebApplication3.Models.AwsAuthorizationSystem",
"AuthorizationSystemId": "123",
"AuthorizationSystemName": null,
"AuthorizationSystemType": null,
"AwsTitle": null
},
{
"@odata.type": "#WebApplication3.Models.AwsAuthorizationSystem",
"AuthorizationSystemId": "456",
"AuthorizationSystemName": null,
"AuthorizationSystemType": null,
"AwsTitle": null
}
]
}
Actual result
{
"@odata.context": "http://localhost:5197/odata/$metadata#identityGovernance/PermissionsAnalytics/Findings('key')/WebApplication3.Models.ExternallyFinding/AccountsWithAccess(WebApplication3.Models.EnumeratedAccountsWithAccess/Accounts())",
"Accounts": [
{
"@odata.type": "#WebApplication3.Models.AwsAuthorizationSystem",
"AuthorizationSystemId": "123",
"AuthorizationSystemName": null,
"AuthorizationSystemType": null,
"AwsTitle": null
},
{
"@odata.type": "#WebApplication3.Models.AwsAuthorizationSystem",
"AuthorizationSystemId": "456",
"AuthorizationSystemName": null,
"AuthorizationSystemType": null,
"AwsTitle": null
}
]
}
Additional detail
Optional, details of the root cause if known. Delete this section if you have no additional details to add.
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.
Assessment
This issue has not been assessed yet.