json-api-dotnet / JsonApiDotNetCore

A framework for building JSON:API compliant REST APIs using ASP.NET and Entity Framework Core.

Home Page:https://www.jsonapi.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ensuring Filter Values Match Resource Property Data Types in Query Layer

abhinavchauhan12 opened this issue · comments

If i read the filter parameter from the query layer then even if the resource property is not string then also the filter value is coming as string in the query layer. Is there any way we can have the value of filter in the same datatype as it is defined in the resource.

e.g
public DateTime StartAt { get; set; }
if filter is applied on 'StartAt' property of resource like filter[startAt]=2024-01-12 15:15:20.000 then if i read the filter value from query layer i get the value in string like '2024-01-12 15:15:20.000' but i want this value to have the same datatype as it is defined in resource.

Which version are you using?

json api dot net core (5.4.0)

How are you reading the filter value exactly? LiteralConstantExpression provides the TypedValue property, which should contain a DateTime object.