src/AspNetCore/Mvc/Mvc/src/JsonProblemDetails/IJsonProblemDetailsBuilderExtensions.cs
/// <summary>
/// This methods adds json problem details abilities to <see cref="ApiBehaviorOptions"/> via
/// <see cref="OptionsServiceCollectionExtensions.Configure{TOptions}(IServiceCollection, Action{TOptions})"/>.
/// This means the order of configuring <see cref="ApiBehaviorOptions"/> matters. You have to call it after
/// calling <see cref="MvcCoreServiceCollectionExtensions.AddMvcCore(IServiceCollection)"/>,
/// <see cref="MvcServiceCollectionExtensions.AddMvc(IServiceCollection)"/> or similiar.
/// </summary>
This methods adds json problem details abilities to  via
.
This means the order of configuring  matters. You have to call it after
calling ,
or similiar.
This methods adds json problem details abilities to via . This means the order of configuring matters . You have to call it after calling or similiar .
public static IJsonProblemDetailsBuilder ConfigureApiBehaviourOptions(this IJsonProblemDetailsBuilder builder)
        {
            var services = builder.Services ?? throw new ArgumentException();
            services.AddOptions<ApiBehaviorOptions>().Configure<ProblemDetailsMiddlewareContextProvider>((options, problemDetailsMiddlewareContextProvider) => {
                options.SuppressMapClientErrors = true;
                options.SuppressModelStateInvalidFilter = false;
                options.InvalidModelStateResponseFactory = (actionContext) => {
                    var middleware = problemDetailsMiddlewareContextProvider.MiddlewareContext;
                    middleware.MappableObject = actionContext.ModelState;
                    var problemDetails = ProblemDetailsUtils.CreateMissingMapper(typeof(ApiVersionProblemDetailsMapper));
                    middleware.FaultyConditionalResult = new ProblemDetailsResult(problemDetails);
                    return new EmptyResult();
                };
            });
            return builder;
        }
public static IJsonProblemDetailsBuilder ConfigureApiBehaviourOptions ( this IJsonProblemDetailsBuilder builder ) { var services = builder . Services ?? throw new ArgumentException ( ) ; services . AddOptions < ApiBehaviorOptions > ( ) . Configure < ProblemDetailsMiddlewareContextProvider > ( ( options , problemDetailsMiddlewareContextProvider ) => { options . SuppressMapClientErrors = true ; options . SuppressModelStateInvalidFilter = false ; options . InvalidModelStateResponseFactory = ( actionContext ) => { var middleware = problemDetailsMiddlewareContextProvider . MiddlewareContext ; middleware . MappableObject = actionContext . ModelState ; var problemDetails = ProblemDetailsUtils . CreateMissingMapper ( typeof ( ApiVersionProblemDetailsMapper ) ) ; middleware . FaultyConditionalResult = new ProblemDetailsResult ( problemDetails ) ; return new EmptyResult ( ) ; } ; } ) ; return builder ; }
This methods adds json problem details abilities to  via
.
This methods adds json problem details abilities to via .
IJsonProblemDetailsBuilder
this