OpenApiOperationTransformerContext.GetOrCreateSchemaAsync 方法

定义

获取或创建指定类型的值 OpenApiSchema 。 使用在文档上注册的任何 IOpenApiSchemaTransformer架构来扩充架构。 如果 parameterDescription 不是 null,架构将随 ApiParameterDescription 信息一起扩充。

public System.Threading.Tasks.Task<Microsoft.OpenApi.OpenApiSchema> GetOrCreateSchemaAsync(Type type, Microsoft.AspNetCore.Mvc.ApiExplorer.ApiParameterDescription? parameterDescription = default, System.Threading.CancellationToken cancellationToken = default);
member this.GetOrCreateSchemaAsync : Type * Microsoft.AspNetCore.Mvc.ApiExplorer.ApiParameterDescription * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.OpenApi.OpenApiSchema>
Public Function GetOrCreateSchemaAsync (type As Type, Optional parameterDescription As ApiParameterDescription = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of OpenApiSchema)

参数

type
Type

要为其创建架构的类型。

parameterDescription
ApiParameterDescription

用于扩充架构的可选参数说明。

cancellationToken
CancellationToken

取消作的取消令牌。

返回

一个表示异步作的任务,其值为类型 OpenApiSchema

适用于