OpenApiDocumentTransformerContext.GetOrCreateSchemaAsync Method

Definition

Gets or creates an OpenApiSchema for the specified type.

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)

Parameters

type
Type

The type for which the schema is being created.

parameterDescription
ApiParameterDescription

An optional parameter description to augment the schema.

cancellationToken
CancellationToken

A cancellation token to cancel the operation.

Returns

A task that represents the asynchronous operation, with a value of type OpenApiSchema.

Remarks

The returned schema is augmented with any IOpenApiSchemaTransformers that are registered on the document. If parameterDescription is not null, the schema will also be augmented with the ApiParameterDescription information, such as default values and validation metadata.

Applies to