'System.Uri' not supported in OData payloads?
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
Assemblies affected
ASP.NET Core OData 8.x
Describe the bug
I have a property in one of my models of type Uri.
And the odata serializer serialize the URI to :
{
"SiteUrl" : "Segments": [
"/"
]
}
instead of:
{
"SiteUrl" : "www.google.com"
}
Reproduce steps
Add a Uri property to a model mapped as an entitySet
Data Model
public class Site
{
[Key]
public int Id { get; set; }
public string Title { get; set; }
public Uri SiteUrl{ get; set; }
}
Response
{
"Id" : 1,
"Title": "google",
"SiteUrl" : "Segments": [
"/"
]
}
Expected behavior
{
"SiteUrl" : "www.google.com"
}
Additional context
https://github.com/OData/odata.net/issues/1929
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 with the ASP.NET Core OData 8.x serializer and reproduce the issue using the provided Site model with a Uri SiteUrl property. Compare the generated payload with the expected URL string and check the linked OData .NET issue for relevant context. Done means Uri properties serialize as their URL values rather than exposing URI segments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100