Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ public static class OpenApiServiceCollectionExtensions
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to register services onto.</param>
/// <param name="documentName">The name of the OpenAPI document associated with registered services.</param>
/// <example>
/// This method is commonly used to add OpenAPI services to the service collection of a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and elsewhere?

Suggested change
/// This method is commonly used to add OpenAPI services to the service collection of a
/// This method is commonly used to add OpenAPI services to the <see cref="IServiceCollection" /> of a

/// <see cref="WebApplicationBuilder"/>, as shown in the following example:
/// <code>
/// var builder = WebApplication.CreateBuilder(args);
/// builder.Services.AddOpenApi("MyWebApi");
/// </code>
/// </example>
public static IServiceCollection AddOpenApi(this IServiceCollection services, string documentName)
{
ArgumentNullException.ThrowIfNull(services);
Expand All @@ -32,6 +40,17 @@ public static IServiceCollection AddOpenApi(this IServiceCollection services, st
/// <param name="services">The <see cref="IServiceCollection"/> to register services onto.</param>
/// <param name="documentName">The name of the OpenAPI document associated with registered services.</param>
/// <param name="configureOptions">A delegate used to configure the target <see cref="OpenApiOptions"/>.</param>
/// <example>
/// This method is commonly used to add OpenAPI services to the service collection of a
/// <see cref="WebApplicationBuilder"/>, as shown in the following example:
/// <code>
/// var builder = WebApplication.CreateBuilder(args);
/// builder.Services.AddOpenApi("MyWebApi", options => {
/// // Add a custom schema transformer for decimal types
/// options.AddSchemaTransformer(DecimalTransformer.TransformAsync);
/// });
/// </code>
/// </example>
public static IServiceCollection AddOpenApi(this IServiceCollection services, string documentName, Action<OpenApiOptions> configureOptions)
{
ArgumentNullException.ThrowIfNull(services);
Expand All @@ -51,13 +70,32 @@ public static IServiceCollection AddOpenApi(this IServiceCollection services, st
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to register services onto.</param>
/// <param name="configureOptions">A delegate used to configure the target <see cref="OpenApiOptions"/>.</param>
/// <example>
/// This method is commonly used to add OpenAPI services to the service collection of a
/// <see cref="WebApplicationBuilder"/>, as shown in the following example:
/// <code>
/// var builder = WebApplication.CreateBuilder(args);
/// builder.Services.AddOpenApi(options => {
/// // Add a custom schema transformer for decimal types
/// options.AddSchemaTransformer(DecimalTransformer.TransformAsync);
/// });
/// </code>
/// </example>
public static IServiceCollection AddOpenApi(this IServiceCollection services, Action<OpenApiOptions> configureOptions)
=> services.AddOpenApi(OpenApiConstants.DefaultDocumentName, configureOptions);

/// <summary>
/// Adds OpenAPI services related to the default document to the specified <see cref="IServiceCollection"/>.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to register services onto.</param>
/// <example>
/// This method is commonly used to add OpenAPI services to the service collection of a
/// <see cref="WebApplicationBuilder"/>, as shown in the following example:
/// <code>
/// var builder = WebApplication.CreateBuilder(args);
/// builder.Services.AddOpenApi();
/// </code>
/// </example>
public static IServiceCollection AddOpenApi(this IServiceCollection services)
=> services.AddOpenApi(OpenApiConstants.DefaultDocumentName);

Expand Down
1 change: 1 addition & 0 deletions src/OpenApi/src/Microsoft.AspNetCore.OpenApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<Reference Include="Microsoft.AspNetCore.Routing" />
<Reference Include="Microsoft.AspNetCore.Mvc.Core" />
<Reference Include="Microsoft.AspNetCore.Mvc.ApiExplorer" />
<Reference Include="Microsoft.AspNetCore.DefaultBuilder" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading