Optional property invalid value
Здравейте, имам лек проблем с един action
Някакви идеи, при положение, че property-то е Nullable, нямам никаква идея защо иска да има Value ?
public class Query : IRequest<ActivitiesContainer>
{
public bool IsHost { get; set; }
public bool IsGoing { get; set; }
public DateTime? StartDate { get; set; }
public int Limit { get; set; }
public int Offset { get; set; }
}
public async Task<IActionResult> Get([FromQuery] ActivitiesQuery query)
{
var activities = await this.Mediator.Send(query);
return Ok(activities);
}
Request URL: http://localhost:5000/api/activities?limit=10&offset=0&isGoing=false&isHost=false&startDate=null
{"errors":{"StartDate":["The value 'null' is not valid for StartDate."]},"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One or more validation errors occurred.","status":400,"traceId":"|8e9e4959-4e4bc6a624465b91."}
{"errors":{"StartDate":["The value 'null' is not valid for StartDate."]},"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One or more validation errors occurred.","status":400,"traceId":"|8e9e4959-4e4bc6a624465b91."}
Версията е ASP.NET Core 3.1