Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

OpenApiEndpointConventionBuilderExtensions.WithOpenApi Method

Definition

Namespace:
Microsoft.AspNetCore.Builder
Assembly:
Microsoft.AspNetCore.OpenApi.dll
Package:
Microsoft.AspNetCore.OpenApi v10.0.0
Package:
Microsoft.AspNetCore.OpenApi v11.0.0-preview.4.26230.115
Package:
Microsoft.AspNetCore.OpenApi v7.0.5
Package:
Microsoft.AspNetCore.OpenApi v8.0.19
Package:
Microsoft.AspNetCore.OpenApi v9.0.8

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Name Description
WithOpenApi<TBuilder>(TBuilder)
Obsolete.

Adds an OpenAPI annotation to Metadata associated with the current endpoint.

WithOpenApi<TBuilder>(TBuilder, Func<OpenApiOperation,OpenApiOperation>)

Adds an OpenAPI annotation to Metadata associated with the current endpoint and modifies it with the given configureOperation.

WithOpenApi<TBuilder>(TBuilder, Func<OpenApiOperation,OpenApiOperation>)
Obsolete.

Adds an OpenAPI annotation to Metadata associated with the current endpoint and modifies it with the given configureOperation.

WithOpenApi<TBuilder>(TBuilder)

Source:
OpenApiEndpointConventionBuilderExtensions.cs
Source:
OpenApiEndpointConventionBuilderExtensions.cs
Source:
OpenApiEndpointConventionBuilderExtensions.cs
Source:
OpenApiEndpointConventionBuilderExtensions.cs
Source:
OpenApiEndpointConventionBuilderExtensions.cs

Caution

WithOpenApi is deprecated and will be removed in a future release. For more information, visit https://aka.ms/aspnet/deprecate/002.

Adds an OpenAPI annotation to Metadata associated with the current endpoint.

[System.Obsolete("WithOpenApi is deprecated and will be removed in a future release. For more information, visit https://aka.ms/aspnet/deprecate/002.", DiagnosticId="ASPDEPR002", UrlFormat="https://aka.ms/aspnet/deprecate/002")]
public static TBuilder WithOpenApi<TBuilder>(this TBuilder builder) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
public static TBuilder WithOpenApi<TBuilder>(this TBuilder builder) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
[<System.Obsolete("WithOpenApi is deprecated and will be removed in a future release. For more information, visit https://aka.ms/aspnet/deprecate/002.", DiagnosticId="ASPDEPR002", UrlFormat="https://aka.ms/aspnet/deprecate/002")>]
static member WithOpenApi : 'Builder -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
static member WithOpenApi : 'Builder -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function WithOpenApi(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder) As TBuilder

Type Parameters

TBuilder

Parameters

builder
TBuilder

The IEndpointConventionBuilder.

Returns

TBuilder

A IEndpointConventionBuilder that can be used to further customize the endpoint.

Attributes

Remarks

This method does not integrate with built-in OpenAPI document generation support in ASP.NET Core and is primarily intended for consumption along-side Swashbuckle.AspNetCore.

Applies to

WithOpenApi<TBuilder>(TBuilder, Func<OpenApiOperation,OpenApiOperation>)

Source:
OpenApiEndpointConventionBuilderExtensions.cs
Source:
OpenApiEndpointConventionBuilderExtensions.cs
Source:
OpenApiEndpointConventionBuilderExtensions.cs

Adds an OpenAPI annotation to Metadata associated with the current endpoint and modifies it with the given configureOperation.

public static TBuilder WithOpenApi<TBuilder>(this TBuilder builder, Func<Microsoft.OpenApi.Models.OpenApiOperation,Microsoft.OpenApi.Models.OpenApiOperation> configureOperation) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
static member WithOpenApi : 'Builder * Func<Microsoft.OpenApi.Models.OpenApiOperation, Microsoft.OpenApi.Models.OpenApiOperation> -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function WithOpenApi(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder, configureOperation As Func(Of OpenApiOperation, OpenApiOperation)) As TBuilder

Type Parameters

TBuilder

Parameters

builder
TBuilder

The IEndpointConventionBuilder.

configureOperation
Func<Microsoft.OpenApi.Models.OpenApiOperation,Microsoft.OpenApi.Models.OpenApiOperation>

An Func<T,TResult> that returns a new OpenAPI annotation given a generated operation.

Returns

TBuilder

A IEndpointConventionBuilder that can be used to further customize the endpoint.

Remarks

This method does not integrate with built-in OpenAPI document generation support in ASP.NET Core and is primarily intended for consumption along-side Swashbuckle.AspNetCore.

Applies to

WithOpenApi<TBuilder>(TBuilder, Func<OpenApiOperation,OpenApiOperation>)

Source:
OpenApiEndpointConventionBuilderExtensions.cs
Source:
OpenApiEndpointConventionBuilderExtensions.cs

Caution

WithOpenApi is deprecated and will be removed in a future release. For more information, visit https://aka.ms/aspnet/deprecate/002.

Adds an OpenAPI annotation to Metadata associated with the current endpoint and modifies it with the given configureOperation.

[System.Obsolete("WithOpenApi is deprecated and will be removed in a future release. For more information, visit https://aka.ms/aspnet/deprecate/002.", DiagnosticId="ASPDEPR002", UrlFormat="https://aka.ms/aspnet/deprecate/002")]
public static TBuilder WithOpenApi<TBuilder>(this TBuilder builder, Func<Microsoft.OpenApi.OpenApiOperation,Microsoft.OpenApi.OpenApiOperation> configureOperation) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
[<System.Obsolete("WithOpenApi is deprecated and will be removed in a future release. For more information, visit https://aka.ms/aspnet/deprecate/002.", DiagnosticId="ASPDEPR002", UrlFormat="https://aka.ms/aspnet/deprecate/002")>]
static member WithOpenApi : 'Builder * Func<Microsoft.OpenApi.OpenApiOperation, Microsoft.OpenApi.OpenApiOperation> -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function WithOpenApi(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder, configureOperation As Func(Of OpenApiOperation, OpenApiOperation)) As TBuilder

Type Parameters

TBuilder

Parameters

builder
TBuilder

The IEndpointConventionBuilder.

configureOperation
Func<OpenApiOperation,OpenApiOperation>

An Func<T,TResult> that returns a new OpenAPI annotation given a generated operation.

Returns

TBuilder

A IEndpointConventionBuilder that can be used to further customize the endpoint.

Attributes

Remarks

This method does not integrate with built-in OpenAPI document generation support in ASP.NET Core and is primarily intended for consumption along-side Swashbuckle.AspNetCore.

Applies to


Feedback

Was this page helpful?