Skip to content

Class XmlDocumentationSchemaTransformer

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

Transforms OpenAPI schemas by enriching them with XML documentation from model types.

csharp
public class XmlDocumentationSchemaTransformer : IOpenApiSchemaTransformer

Inheritance

objectXmlDocumentationSchemaTransformer

Implements

IOpenApiSchemaTransformer

Inherited Members

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

Remarks

This transformer enhances schema specifications with:

  • Type XML documentation as schema description
  • Property documentation for all public properties
  • Nullable type information
  • Enum value listings
  • Support for JsonPropertyName attributes

Constructors

XmlDocumentationSchemaTransformer(ILogger<XmlDocumentationSchemaTransformer>, IXmlDocumentationService)

Transforms OpenAPI schemas by enriching them with XML documentation from model types.

csharp
public XmlDocumentationSchemaTransformer(ILogger<XmlDocumentationSchemaTransformer> logger, IXmlDocumentationService xmlDocumentationService)

Parameters

logger ILogger<XmlDocumentationSchemaTransformer>

xmlDocumentationService IXmlDocumentationService

Remarks

This transformer enhances schema specifications with:

  • Type XML documentation as schema description
  • Property documentation for all public properties
  • Nullable type information
  • Enum value listings
  • Support for JsonPropertyName attributes

Methods

TransformAsync(OpenApiSchema, OpenApiSchemaTransformerContext, CancellationToken)

Transforms the specified OpenAPI schema.

csharp
public Task TransformAsync(OpenApiSchema schema, OpenApiSchemaTransformerContext context, CancellationToken cancellationToken)

Parameters

schema OpenApiSchema

The to modify.

context OpenApiSchemaTransformerContext

The associated with the .

cancellationToken CancellationToken

The cancellation token to use.

Returns

Task

The task object representing the asynchronous operation.