Skip to content

Microsoft.AspNetCore.OpenApi

The Cratis.Arc.OpenApi package provides deep integration with Microsoft.AspNetCore.OpenApi (.NET 10+), automatically generating accurate API documentation for all Arc-specific features and conventions.

TopicDescription
ConceptsHow concept types are mapped to their underlying primitive types in the API schema.
CommandsHow command responses are wrapped with CommandResult in the API documentation.
QueriesHow query responses are wrapped with QueryResult, including pagination parameters.
EnumsHow enum values are represented as string names rather than integers.
FromRequest AttributeHow complex model binding with [FromRequest] is reflected in the API schema.
Model-Bound OperationsHow minimal API command and query endpoints appear in the API documentation.

Add the Cratis.Arc.OpenApi NuGet package to your project and call AddConcepts() inside your AddOpenApi configuration:

builder.Services.AddOpenApi(options => options.AddConcepts());
app.MapOpenApi();

The AddConcepts() method registers all schema and operation transformers automatically.

The Cratis.Arc.OpenApi package targets .NET 10 and later. The transformer API (IOpenApiSchemaTransformer, IOpenApiOperationTransformer) and the underlying Microsoft.OpenApi 2.x schema types are only available from .NET 10 onwards.

Arc also ships a separate Cratis.Arc.Swagger package for Swashbuckle-based Swagger UI. Both packages cover the same set of Arc features, but use different APIs:

Cratis.Arc.SwaggerCratis.Arc.OpenApi
FrameworkSwashbuckle (ISchemaFilter, IOperationFilter)Microsoft.AspNetCore.OpenApi (IOpenApiSchemaTransformer, IOpenApiOperationTransformer)
.NET versionnet8.0+net10.0+
Registrationservices.AddSwaggerGen(o => o.AddConcepts())services.AddOpenApi(o => o.AddConcepts())

Both are fully independent; choose the one that matches your toolchain.