JsonApiDotNetCore icon indicating copy to clipboard operation
JsonApiDotNetCore copied to clipboard

Support Uri and Version objects in resource models

Open bkoelman opened this issue 3 years ago • 0 comments

Because System.Text.Json supports serializing Version and Uri objects, it would be interesting to see if we can make the following work:

public class ExampleResource : IIdentifiable<long>
{
    [Attr]
    public Version LatestVersion { get; set; }

    [Attr]
    public Uri HelpLink { get; set; }
}

At the minimum, this requires:

  • Updates to RuntimeTypeConverter (used for query strings and expressions)
  • ASP.NET ModelState binding/validation support
  • EF Core support https://stackoverflow.com/questions/5037022/map-system-uri-using-entity-framework-fluent-api, https://github.com/dotnet/efcore/issues/12727
  • PostgreSQL support?

Test coverage:

  • Using these types in JSON request/response bodies, including database roundtrip
  • ModelState validation on incoming request bodies
  • Filters in query strings (including greater/less-than for versions), sorting

bkoelman avatar Sep 03 '22 16:09 bkoelman