MinimalApis.Extensions
MinimalApis.Extensions copied to clipboard
.WithParameterValidation() does not work with [FromRoute] parameters
//Should fail when id does not equal "hello" or "world". Expect 400 response
builder.MapGet("/test/{id}", async ([FromRoute, RegularExpression("^(hello|world)$")] string id) =>
{
//Currently returns "hello world" regardless of validation
return Results.Ok("hello world");
}).WithParameterValidation();