We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Thanks to recent changes in rc.2 (dotnet/aspnetcore#36935), something like the following should now be possible:
app.MapPost("/todos", (Todo todo, TodoDb db) => { if (!todo.IsValid(out var errors)) { return Result.ValidationProblem(errors); } db.Todos.Add(todo); await db.SaveChanges(); return Result.Created($"/todos/{todo.Id}", todo); }); public class Todo : IValidatable<Todo> { [Required] public string? Title { get; set; } } namespace MiniValidation { public interface IValidatable<TValue> where TValue : IValidatable<TValue> { public sealed IsValid(out IDictionary<string, string[]> errors) { var isValid = MiniValidator.TryValidate(this, out var errs); errors = errs; return isValid; } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Thanks to recent changes in rc.2 (dotnet/aspnetcore#36935), something like the following should now be possible:
The text was updated successfully, but these errors were encountered: