Share via


ApiBehaviorOptions.SuppressUseValidationProblemDetailsForInvalidModelStateResponses Property

Definition

Gets or sets a value that determines if controllers annotated with ApiControllerAttribute respond using ValidationProblemDetails in InvalidModelStateResponseFactory.

When true, SuppressModelStateInvalidFilter returns errors in ModelStateDictionary as a ValidationProblemDetails. Otherwise, SuppressModelStateInvalidFilter returns the errors in the format determined by SerializableError.

public:
 property bool SuppressUseValidationProblemDetailsForInvalidModelStateResponses { bool get(); void set(bool value); };
public bool SuppressUseValidationProblemDetailsForInvalidModelStateResponses { get; set; }
member this.SuppressUseValidationProblemDetailsForInvalidModelStateResponses : bool with get, set
Public Property SuppressUseValidationProblemDetailsForInvalidModelStateResponses As Boolean

Property Value

The default value is true if the version is Version_2_2 or later; false otherwise.

Remarks

This property is associated with a compatibility switch and can provide a different behavior depending on the configured compatibility version for the application. See CompatibilityVersion for guidance and examples of setting the application's compatibility version.

Configuring the desired value of the compatibility switch by calling this property's setter will take precedence over the value implied by the application's CompatibilityVersion.

If the application's compatibility version is set to Version_2_1 or lower then this setting will have the value false unless explicitly configured.

If the application's compatibility version is set to Version_2_2 or higher then this setting will have the value true unless explicitly configured.

Applies to