-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to control the schema response in ASP.NET Core? #5
Comments
Hi @xplatsolutions, interesting feature. Perhaps it's already possible by customizing the default problem details as explained here: https://learn.microsoft.com/en-us/aspnet/core/web-api/handle-errors?view=aspnetcore-7.0#implement-problemdetailsfactory. Let me look into it and if it's not possible I'll integrate it into the MVC package and perhaps the Minimal APIs package. |
That would be amazing if we figure it out, can be tricky but I imagine something like adding our own JSON for each error. Example:
|
I just finished the initial work for a custom result factory. In your case it would work something like this:
You can return a fully custom response when the model state is invalid. You will be able to access the |
This looks like exactly what I need to create my own custom response for all the errors! I can try it out ASAP if you want :) |
Hi @xplatsolutions, I just released the v1.1.0 versions of the packages containing the option for providing a custom result factory. |
I will check it out ASAP! Thanks for this one |
Confirming the approach worked like a charm! Thank you |
Awesome! Thanks for getting back. |
I would like to set my own response schema in the 400 Bad Request response.
e.g.
I am using the auto-validation package
SharpGrip.FluentValidation.AutoValidation.Mvc
.The text was updated successfully, but these errors were encountered: