Skip to content

Class OpenApiExtensions

Namespace: Momentum.ServiceDefaults.Api.OpenApi.Extensions
Assembly: Momentum.ServiceDefaults.Api.dll

Provides extension methods for configuring OpenAPI with enhanced XML documentation support.

csharp
public static class OpenApiExtensions

Inheritance

objectOpenApiExtensions

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Methods

AddOpenApiWithXmlDocSupport(IServiceCollection, Action<OpenApiOptions>?)

Adds OpenAPI services with XML documentation support and automatic response type conventions.

csharp
public static IServiceCollection AddOpenApiWithXmlDocSupport(this IServiceCollection services, Action<OpenApiOptions>? config = null)

Parameters

services IServiceCollection

The service collection to configure.

config Action<OpenApiOptions>?

An optional action to configure additional OpenAPI options.

Returns

IServiceCollection

The configured service collection for method chaining.

Remarks

This method configures the following:

  • XML documentation service for reading XML comment files
  • Document transformer for adding API-level XML documentation
  • Operation transformer for adding endpoint-level XML documentation
  • Schema transformer for adding model-level XML documentation
  • Automatic response type convention for standardized API responses