aspnetcore: Add overloads for validation problem results that accept IReadOnlyDictionary
Sometimes all you have is a IReadOnlyDictionary and you don’t want to have to downcast it or wrap it to pass it to the helper methods.
namespace Microsoft.AspNetCore.Http;
public static class Results
{
+ public static IResult ValidationProblem(IReadOnlyDictionary<string, string[]> errors,
+ string? detail = null,
+ string? instance = null,
+ int? statusCode = null,
+ string? title = null,
+ string? type = null,
+ IReadOnlyDictionary<string, object?>? extensions = null);
+ public static IResult Problem(
+ string? detail = null,
+ string? instance = null,
+ int? statusCode = null,
+ string? title = null,
+ string? type = null,
+ IReadOnlyDictionary<string, object?>? extensions = null);
}
public static class TypedResults
{
+ public static ValidationProblem ValidationProblem(IReadOnlyDictionary<string, string[]> errors,
+ string? detail = null,
+ string? instance = null,
+ string? title = null,
+ string? type = null,
+ IReadOnlyDictionary<string, object?>? extensions = null);
+ public static ProblemHttpResult Problem(
+ string? detail = null,
+ string? instance = null,
+ string? title = null,
+ string? type = null,
+ IReadOnlyDictionary<string, object?>? extensions = null);
}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (14 by maintainers)
API Review Notes:
Dictionary<string, string[]>.IEnumerable<KeyValuePair<string, string[]>>instead? Yes.errorsandextensionsparameters? Might as well. It will accept more arguments, and we’re not modifying either dictionary.API Approved!
@halter73 thank you for reopening this one. I already opened #56370 about the new constructor for
HttpValidationProblemDetails.