Closed isaacOjeda closed 2 years ago
This looks great, thanks!
I'll try and get it merged in with the next Carter release once .NET6 is out
On Sun, 7 Nov 2021 at 01:51, Isaac Ojeda @.***> wrote:
New extension for ValidationResult called GetValidationProblems.
Example Usage:
var result = request.Validate(command);
if (!result.IsValid)
{
return Results.ValidationProblem(result.ToValidationProblems());
}
Response:
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"errors": {
"Name": [ "'Name' no debería estar vacío." ], "Description": [ "'Description' no debería estar vacío." ], "Price": [ "'Price' no debería estar vacío." ]
}
}
You can view, comment on, or merge this pull request online at:
https://github.com/CarterCommunity/Carter/pull/281 Commit Summary
- Added a new extention for ValidationResult https://github.com/CarterCommunity/Carter/pull/281/commits/fa12a312260bb10d850420611ea41797a03e9b03
File Changes
(1 file https://github.com/CarterCommunity/Carter/pull/281/files)
- M src/Carter/ModelBinding/ValidationExtensions.cs https://github.com/CarterCommunity/Carter/pull/281/files#diff-049f2ec28a0486ea13e53e68613de3495b4dcf486709eb88b983ba541025b8cc (19)
Patch Links:
- https://github.com/CarterCommunity/Carter/pull/281.patch
- https://github.com/CarterCommunity/Carter/pull/281.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/CarterCommunity/Carter/pull/281, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAZVJUWV37IW4WG6WODTITUKXLQJANCNFSM5HQHWVLQ .
Thanks @isaacOjeda 👍
New extension for
ValidationResult
calledGetValidationProblems
.Example Usage:
Response: