MinimalApis.Extensions icon indicating copy to clipboard operation
MinimalApis.Extensions copied to clipboard

.WithParameterValidation() does not work with [FromRoute] parameters

Open JCKortlang opened this issue 8 months ago • 1 comments

        //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();

JCKortlang avatar May 31 '24 00:05 JCKortlang