OpenApiRouteHandlerBuilderExtensions.ProducesValidationProblem 方法

定义

IProducesResponseTypeMetadata为 生成builder的所有终结点添加 类型MetadataHttpValidationProblemDetails为 的 。

public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder ProducesValidationProblem (this Microsoft.AspNetCore.Builder.RouteHandlerBuilder builder, int statusCode = 400, string? contentType = default);
static member ProducesValidationProblem : Microsoft.AspNetCore.Builder.RouteHandlerBuilder * int * string -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder
<Extension()>
Public Function ProducesValidationProblem (builder As RouteHandlerBuilder, Optional statusCode As Integer = 400, Optional contentType As String = Nothing) As RouteHandlerBuilder

参数

statusCode
Int32

响应状态代码。 默认为 Status400BadRequest

contentType
String

响应内容类型。 默认为“application/problem+json”。

返回

可用于 RouteHandlerBuilder 进一步自定义终结点的 。

适用于