Description
Hi.
When trying to migrate some existing endpoints to minimal apis, I discovered that is not as easy as in controllers to change the behaviour of a binding error (and I wanted to return the same responses...).
In controllers you have the InvalidModelStateResponseFactory which you can use to modify the response to these invalid requests:
When trying to do the same in minimal apis, I have found two ways, filter or middleware.
With a filter you get the arguments but you don't know why the binding failed (required parameter not provided vs. not parsable) and the arguments have default values (like 0 but you passed a string)
With a middleware you can catch the exception but you only get a message like "Failed to bind parameter "long id" from "this has to be a long"."
So the question is, is there another way so I can return the same response as before when using controllers but using minimal apis?
Thanks.