RepletoryLib.Api.Versioning
1.0.0
dotnet add package RepletoryLib.Api.Versioning --version 1.0.0
NuGet\Install-Package RepletoryLib.Api.Versioning -Version 1.0.0
<PackageReference Include="RepletoryLib.Api.Versioning" Version="1.0.0" />
<PackageVersion Include="RepletoryLib.Api.Versioning" Version="1.0.0" />
<PackageReference Include="RepletoryLib.Api.Versioning" />
paket add RepletoryLib.Api.Versioning --version 1.0.0
#r "nuget: RepletoryLib.Api.Versioning, 1.0.0"
#:package RepletoryLib.Api.Versioning@1.0.0
#addin nuget:?package=RepletoryLib.Api.Versioning&version=1.0.0
#tool nuget:?package=RepletoryLib.Api.Versioning&version=1.0.0
RepletoryLib.Api.Versioning
URL segment and header-based API versioning for ASP.NET Core.
Part of the RepletoryLib ecosystem -- standalone, reusable .NET 10 libraries with zero business logic.
Overview
RepletoryLib.Api.Versioning configures Asp.Versioning for ASP.NET Core with URL segment versioning (/api/v1/..., /api/v2/...) and header-based versioning. It integrates with Swagger to generate versioned API documentation.
Key Features
- URL segment versioning --
/api/v1/products,/api/v2/products - Header versioning --
api-version: 2.0header support - Version reporting -- Response headers indicate supported API versions
- Default version -- Configurable default when version is unspecified
Installation
dotnet add package RepletoryLib.Api.Versioning
Dependencies
| Package | Type |
|---|---|
RepletoryLib.Common |
RepletoryLib |
Asp.Versioning.Mvc |
NuGet |
Asp.Versioning.Mvc.ApiExplorer |
NuGet |
Quick Start
using RepletoryLib.Api.Versioning;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRepletoryVersioning();
Configuration
VersioningOptions
| Property | Type | Default | Description |
|---|---|---|---|
DefaultVersion |
string |
"1.0" |
Default API version when unspecified |
AssumeDefaultVersionWhenUnspecified |
bool |
true |
Use default version if client doesn't specify |
ReportApiVersions |
bool |
true |
Include api-supported-versions header in responses |
Usage Examples
Versioned Controllers
using Asp.Versioning;
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("1.0")]
public class ProductsV1Controller : ControllerBase
{
[HttpGet]
public IActionResult GetProducts() => Ok(new[] { "Widget v1" });
}
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("2.0")]
public class ProductsV2Controller : ControllerBase
{
[HttpGet]
public IActionResult GetProducts() => Ok(new[] { new { Name = "Widget", Version = 2 } });
}
Requests:
GET /api/v1/products→["Widget v1"]GET /api/v2/products→[{"name":"Widget","version":2}]
Custom Configuration
builder.Services.AddRepletoryVersioning(options =>
{
options.DefaultVersion = "2.0";
options.AssumeDefaultVersionWhenUnspecified = false;
});
Integration with Other RepletoryLib Packages
| Package | Relationship |
|---|---|
RepletoryLib.Common |
Direct dependency |
RepletoryLib.Api.Swagger |
Generates per-version Swagger documents |
License
This project is licensed under the MIT License.
Copyright (c) 2024-2026 Repletory.
For complete documentation, infrastructure setup, and configuration reference, see the RepletoryLib main repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Asp.Versioning.Mvc (>= 8.1.0)
- Asp.Versioning.Mvc.ApiExplorer (>= 8.1.0)
- RepletoryLib.Common (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 145 | 3/2/2026 |