TaskHub.Shared provides a unified way to version your APIs and document them using Swagger (OpenAPI).
TaskHub uses URL-based versioning by default (e.g., /v1/tasks).
"Versioning": {
"DefaultVersion": "1.0",
"AssumeDefaultVersionWhenUnspecified": true
}
Decorate your controllers with the [ApiVersion] and [Route] attributes.
[ApiVersion("1.0")]
[Route("v{version:apiVersion}/tasks")]
public class TasksController : ControllerBase { ... }
The TaskHub.Shared.Swagger module pre-configures Swagger UI to handle TaskHub’s specific patterns.
"Swagger": {
"Title": "TaskHub API",
"Version": "v1",
"IsSecurityEnabled": true
}
IsSecurityEnabled is true, a “Authorize” button appears, allowing you to paste a JWT token..csproj).In your Program.cs:
builder.Services.AddAppVersioning(builder.Configuration.GetSection("Versioning").Bind);
builder.Services.AddAppSwagger(builder.Configuration.GetSection("Swagger").Bind);
In your app configuration:
app.UseSwagger();
app.UseAppSwaggerUI(builder.Configuration.GetSection("Swagger").Bind);