Loading...
Loading...
Generates and configures Scalar OpenAPI UI for API documentation. Use when: Adding API documentation to services, configuring OpenAPI endpoints, customizing documentation themes
npx skill4agent add stuartf303/sorcha scalarAddOpenApi()MapScalarApiReference()// Program.cs - Service setup
builder.Services.AddOpenApi();
var app = builder.Build();
app.MapOpenApi();
if (app.Environment.IsDevelopment())
{
app.MapScalarApiReference(options =>
{
options
.WithTitle("Blueprint Service")
.WithTheme(ScalarTheme.Purple)
.WithDefaultHttpClient(ScalarTarget.CSharp, ScalarClient.HttpClient);
});
}// Aggregated OpenAPI from all services
app.MapGet("/openapi/aggregated.json", async (OpenApiAggregationService service) =>
{
var spec = await service.GetAggregatedOpenApiAsync();
return Results.Json(spec);
})
.ExcludeFromDescription();
app.MapScalarApiReference(options =>
{
options
.WithTitle("Sorcha API Gateway - All Services")
.WithTheme(ScalarTheme.Purple)
.WithDefaultHttpClient(ScalarTarget.CSharp, ScalarClient.HttpClient)
.WithOpenApiRoutePattern("/openapi/aggregated.json");
});| Concept | Usage | Example |
|---|---|---|
| Register OpenAPI services | |
| Expose | |
| Mount Scalar UI at | See examples above |
| Visual theme enum | |
| Code generation target | |
| HTTP client library | |
app.MapPost("/api/wallets", handler)
.WithName("CreateWallet")
.WithSummary("Create a new wallet")
.WithDescription("Creates an HD wallet with the specified algorithm")
.WithTags("Wallets");builder.Services.AddOpenApi(options =>
{
options.AddDocumentTransformer((document, context, ct) =>
{
document.Info.Title = "Register Service API";
document.Info.Version = "1.0.0";
document.Info.Description = """
# Register Service
## Overview
Provides a **distributed ledger** for immutable transactions.
## Key Features
- Cryptographic signatures
- Chain integrity verification
""";
return Task.CompletedTask;
});
});Fetch latest Scalar documentation with Context7.
mcp__context7__resolve-library-id/websites/guides_scalarmcp__context7__query-docs/websites/guides_scalar