Skip to content

Commit 94ad1d4

Browse files
Make DefaultProblemDetailsFactory public (#55666)
Co-authored-by: Safia Abdalla <[email protected]>
1 parent dad78b3 commit 94ad1d4

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/Mvc/Mvc.Core/src/Infrastructure/DefaultProblemDetailsFactory.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,21 @@
1010

1111
namespace Microsoft.AspNetCore.Mvc.Infrastructure;
1212

13-
internal sealed class DefaultProblemDetailsFactory : ProblemDetailsFactory
13+
/// <summary>
14+
/// The `DefaultProblemDetailsFactory` is a concrete implementation of the `ProblemDetailsFactory` abstract class.
15+
/// It provides methods to create instances of `ProblemDetails` and `ValidationProblemDetails` with default settings.
16+
/// This class uses the provided `ApiBehaviorOptions` for client error mapping and an optional custom configuration action to further customize the problem details.
17+
/// </summary>
18+
public sealed class DefaultProblemDetailsFactory : ProblemDetailsFactory
1419
{
1520
private readonly ApiBehaviorOptions _options;
1621
private readonly Action<ProblemDetailsContext>? _configure;
1722

23+
/// <summary>
24+
/// Initializes a new instance of the <see cref="DefaultProblemDetailsFactory"/> class.
25+
/// </summary>
26+
/// <param name="options">The options for API behavior.</param>
27+
/// <param name="problemDetailsOptions">The options for customizing problem details.</param>
1828
public DefaultProblemDetailsFactory(
1929
IOptions<ApiBehaviorOptions> options,
2030
IOptions<ProblemDetailsOptions>? problemDetailsOptions = null)
@@ -23,6 +33,8 @@ public DefaultProblemDetailsFactory(
2333
_configure = problemDetailsOptions?.Value?.CustomizeProblemDetails;
2434
}
2535

36+
37+
/// <inheritdoc />
2638
public override ProblemDetails CreateProblemDetails(
2739
HttpContext httpContext,
2840
int? statusCode = null,
@@ -47,6 +59,7 @@ public override ProblemDetails CreateProblemDetails(
4759
return problemDetails;
4860
}
4961

62+
/// <inheritdoc />
5063
public override ValidationProblemDetails CreateValidationProblemDetails(
5164
HttpContext httpContext,
5265
ModelStateDictionary modelStateDictionary,

src/Mvc/Mvc.Core/src/PublicAPI.Unshipped.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ virtual Microsoft.AspNetCore.Mvc.ControllerBase.Problem(string? detail, string?
55
virtual Microsoft.AspNetCore.Mvc.ControllerBase.Problem(string? detail = null, string? instance = null, int? statusCode = null, string? title = null, string? type = null, System.Collections.Generic.IDictionary<string!, object?>? extensions = null) -> Microsoft.AspNetCore.Mvc.ObjectResult!
66
virtual Microsoft.AspNetCore.Mvc.ControllerBase.ValidationProblem(string? detail, string? instance, int? statusCode, string? title, string? type, Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary? modelStateDictionary) -> Microsoft.AspNetCore.Mvc.ActionResult!
77
virtual Microsoft.AspNetCore.Mvc.ControllerBase.ValidationProblem(string? detail = null, string? instance = null, int? statusCode = null, string? title = null, string? type = null, Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary? modelStateDictionary = null, System.Collections.Generic.IDictionary<string!, object?>? extensions = null) -> Microsoft.AspNetCore.Mvc.ActionResult!
8+
Microsoft.AspNetCore.Mvc.Infrastructure.DefaultProblemDetailsFactory
9+
Microsoft.AspNetCore.Mvc.Infrastructure.DefaultProblemDetailsFactory.DefaultProblemDetailsFactory(Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Mvc.ApiBehaviorOptions!>! options, Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Http.ProblemDetailsOptions!>? problemDetailsOptions = null) -> void
10+
override Microsoft.AspNetCore.Mvc.Infrastructure.DefaultProblemDetailsFactory.CreateProblemDetails(Microsoft.AspNetCore.Http.HttpContext! httpContext, int? statusCode = null, string? title = null, string? type = null, string? detail = null, string? instance = null) -> Microsoft.AspNetCore.Mvc.ProblemDetails!
11+
override Microsoft.AspNetCore.Mvc.Infrastructure.DefaultProblemDetailsFactory.CreateValidationProblemDetails(Microsoft.AspNetCore.Http.HttpContext! httpContext, Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary! modelStateDictionary, int? statusCode = null, string? title = null, string? type = null, string? detail = null, string? instance = null) -> Microsoft.AspNetCore.Mvc.ValidationProblemDetails!

0 commit comments

Comments
 (0)