OData / OData/AspNetCoreOData

'System.Uri' not supported in OData payloads?

Open
#976 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.