File tree Expand file tree Collapse file tree 4 files changed +50
-28
lines changed
src/JsonApiDotNetCore/Middleware Expand file tree Collapse file tree 4 files changed +50
-28
lines changed Original file line number Diff line number Diff line change 1- using System ;
2- using JsonApiDotNetCore . Internal ;
1+ using JsonApiDotNetCore . Internal ;
32using Microsoft . AspNetCore . Mvc ;
43using Microsoft . AspNetCore . Mvc . Filters ;
54using Microsoft . Extensions . Logging ;
65
76namespace JsonApiDotNetCore . Middleware
87{
9- public interface IJsonApiExceptionFilterProvider
10- {
11- Type Get ( ) ;
12- }
13-
14- public class JsonApiExceptionFilterProvider : IJsonApiExceptionFilterProvider
15- {
16- public Type Get ( ) => typeof ( DefaultExceptionFilter ) ;
17- }
18-
8+ /// <summary>
9+ /// Global exception filter that wraps any thrown error with a JsonApiException.
10+ /// </summary>
1911 public class DefaultExceptionFilter : ActionFilterAttribute , IExceptionFilter
2012 {
2113 private readonly ILogger _logger ;
Original file line number Diff line number Diff line change 1- using System ;
1+ using System ;
22using System . Linq ;
33using JsonApiDotNetCore . Internal ;
44using JsonApiDotNetCore . Internal . Contracts ;
77
88namespace JsonApiDotNetCore . Middleware
99{
10- public interface IJsonApiTypeMatchFilterProvider
11- {
12- Type Get ( ) ;
13- }
14-
15- public class JsonApiTypeMatchFilterProvider : IJsonApiTypeMatchFilterProvider
16- {
17- public Type Get ( ) => typeof ( TypeMatchFilter ) ;
18- }
19-
20- public class TypeMatchFilter : IActionFilter
10+ /// <summary>
11+ /// Action filter used to verify the incoming type matches the target type, else return a 409
12+ /// </summary>
13+ public class DefaultTypeMatchFilter : IActionFilter
2114 {
2215 private readonly IContextEntityProvider _provider ;
2316
24- public TypeMatchFilter ( IContextEntityProvider provider )
17+ public DefaultTypeMatchFilter ( IContextEntityProvider provider )
2518 {
2619 _provider = provider ;
2720 }
2821
29- /// <summary>
30- /// Used to verify the incoming type matches the target type, else return a 409
31- /// </summary>
3222 public void OnActionExecuting ( ActionExecutingContext context )
3323 {
3424 var request = context . HttpContext . Request ;
Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ namespace JsonApiDotNetCore . Middleware
4+ {
5+ /// <summary>
6+ /// Provides the type of the global exception filter that is configured in MVC during startup.
7+ /// This can be overridden to let JADNC use your own exception filter. The default exception filter used
8+ /// is <see cref="DefaultExceptionFilter"/>
9+ /// </summary>
10+ public interface IJsonApiExceptionFilterProvider
11+ {
12+ Type Get ( ) ;
13+ }
14+
15+ /// <inheritdoc/>
16+ public class JsonApiExceptionFilterProvider : IJsonApiExceptionFilterProvider
17+ {
18+ public Type Get ( ) => typeof ( DefaultExceptionFilter ) ;
19+ }
20+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ namespace JsonApiDotNetCore . Middleware
4+ {
5+ /// <summary>
6+ /// Provides the type of the global action filter that is configured in MVC during startup.
7+ /// This can be overridden to let JADNC use your own exception filter. The default exception filter used
8+ /// is <see cref="DefaultTypeMatchFilter"/>
9+ /// </summary>
10+ public interface IJsonApiTypeMatchFilterProvider
11+ {
12+ Type Get ( ) ;
13+ }
14+
15+ /// <inheritdoc/>
16+ public class JsonApiTypeMatchFilterProvider : IJsonApiTypeMatchFilterProvider
17+ {
18+ public Type Get ( ) => typeof ( DefaultTypeMatchFilter ) ;
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments