You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to change the ProblemDetails.Type for a 422 response that is the result of MVC validation error (after having called AddProblemDetailsConventions).
Reading the documentation of MapStatusCode, this should be possible with:
services
.AddProblemDetails(options =>
{
options.MapStatusCode = ctx => // change Type in case of 422
}
.AddProblemDetailsConventions()
I find however that the Type is not changed at all. In order to do so, I must replace the MvcProblemDetailsFactory (after calling AddProblemDetailsConventions) and substitute my own which has a modified CreateValidationProblemDetails:
Probably this is because Options.MapStatusCode is not being used in CreateValidationProblemDetails in ProblemDetailsFactory? Is there a way to change the produced Type using the functionality of this library?
The text was updated successfully, but these errors were encountered:
Sorry for the late reply. Maybe you could try to set the OnBeforeWriteDetails hook? It should let you modify the ProblemDetails object before it's written to the response:
I want to change the
ProblemDetails.Type
for a 422 response that is the result of MVC validation error (after having calledAddProblemDetailsConventions
).Reading the documentation of
MapStatusCode
, this should be possible with:I find however that the
Type
is not changed at all. In order to do so, I must replace theMvcProblemDetailsFactory
(after callingAddProblemDetailsConventions
) and substitute my own which has a modifiedCreateValidationProblemDetails
:Probably this is because
Options.MapStatusCode
is not being used inCreateValidationProblemDetails
inProblemDetailsFactory
? Is there a way to change the producedType
using the functionality of this library?The text was updated successfully, but these errors were encountered: