PANiXiDA.Core.Presentation.Http
2.0.7
See the version list below for details.
dotnet add package PANiXiDA.Core.Presentation.Http --version 2.0.7
NuGet\Install-Package PANiXiDA.Core.Presentation.Http -Version 2.0.7
<PackageReference Include="PANiXiDA.Core.Presentation.Http" Version="2.0.7" />
<PackageVersion Include="PANiXiDA.Core.Presentation.Http" Version="2.0.7" />
<PackageReference Include="PANiXiDA.Core.Presentation.Http" />
paket add PANiXiDA.Core.Presentation.Http --version 2.0.7
#r "nuget: PANiXiDA.Core.Presentation.Http, 2.0.7"
#:package PANiXiDA.Core.Presentation.Http@2.0.7
#addin nuget:?package=PANiXiDA.Core.Presentation.Http&version=2.0.7
#tool nuget:?package=PANiXiDA.Core.Presentation.Http&version=2.0.7
PANiXiDA.Core.Presentation.Http
PANiXiDA.Core.Presentation.Http is a reusable ASP.NET Core HTTP presentation package for PANiXiDA applications.
It provides common Minimal API endpoint conventions, API versioning, OpenAPI setup, Problem Details handling, health checks, request logging, exception handling, forwarded headers configuration, and helpers for mapping PANiXiDA.Core.ResultPattern results to HTTP responses.
Status
Features
AddHttpregisters the default HTTP presentation services.UseHttpadds the default middleware pipeline and maps discovered endpoint groups.- Module assemblies can be mapped to separate OpenAPI documents and Scalar sources through the
HttpModulesconfiguration section. - Health checks are registered by
AddHttpand exposed at/healthbyUseHttp. IEndpointGroupdefines route, resource name, and API version metadata for Minimal API endpoint groups.IEndpoint<TGroup>defines route, name, and summary metadata for endpoints that belong to a specific group.EndpointMapperdiscovers and maps endpoints in a deterministic type-name order.EndpointConstants.EndpointPrefixdefines/api/v{version:apiVersion}.ResultHttpMappermapsResultandResult<T>toIResult.
Requirements
- .NET 10 SDK.
- ASP.NET Core Minimal API application.
Installation
<ItemGroup>
<PackageReference Include="PANiXiDA.Core.Presentation.Http" Version="2.0.0" />
</ItemGroup>
Quick Start
using PANiXiDA.Core.Presentation.Http.DependencyInjection;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHttp(builder.Configuration);
var app = builder.Build();
app.UseHttp(typeof(Program).Assembly);
app.Run();
Forwarded Headers
The package configures these forwarded headers by default:
ForwardedHeaders.XForwardedFor |
ForwardedHeaders.XForwardedHost |
ForwardedHeaders.XForwardedProto
The package also clears the default loopback-only KnownIPNetworks and KnownProxies restrictions so applications behind Kubernetes ingress or Gateway API proxies can process forwarded headers without per-service proxy registration.
Additional values can be bound from the standard ASP.NET Core ForwardedHeadersOptions model by adding a ForwardedHeaders section to the application configuration.
{
"ForwardedHeaders": {
"ForwardedHeaders": "XForwardedFor, XForwardedHost, XForwardedProto",
"ForwardLimit": 2,
"RequireHeaderSymmetry": true,
"AllowedHosts": [
"api.example.com"
]
}
}
For stricter trust boundaries, configure ForwardedHeadersOptions directly after AddHttp.
using Microsoft.AspNetCore.HttpOverrides;
using System.Net;
builder.Services.AddHttp(builder.Configuration);
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
options.KnownProxies.Add(IPAddress.Parse("10.0.0.10"));
});
Health Checks
AddHttp registers ASP.NET Core health check services, and UseHttp maps the health check endpoint at /health.
GET /health
Services can add their own checks after AddHttp.
using Microsoft.Extensions.Diagnostics.HealthChecks;
builder.Services.AddHealthChecks()
.AddCheck("self", () => HealthCheckResult.Healthy());
Endpoint Groups
An endpoint group owns a route prefix, resource name, API version, and the call to map endpoints that belong to the group.
using Asp.Versioning;
using Microsoft.AspNetCore.Routing;
using PANiXiDA.Core.Presentation.Http.Endpoints;
public sealed class OrdersEndpointGroup : IEndpointGroup
{
public string Route { get; } = "/orders";
public string Name { get; } = "Orders";
public ApiVersion ApiVersion { get; } = new(1, 0);
public void Map(IEndpointRouteBuilder endpoints)
{
EndpointMapper.MapGroupEndpoints<OrdersEndpointGroup>(endpoints);
}
}
The final route prefix is /api/v{version}/orders.
Groups that require a custom root route can map their endpoints through an explicit RouteGroupBuilder.
The registered HTTP module metadata is attached to custom groups as well, so their endpoints remain available in the corresponding module OpenAPI document.
public void Map(IEndpointRouteBuilder endpoints)
{
var group = endpoints.MapGroup("/connect")
.WithTags(Name);
EndpointMapper.MapGroupEndpoints<OAuthEndpointGroup>(
group,
endpoints.ServiceProvider);
}
Endpoints
An endpoint implements IEndpoint<TGroup>, where TGroup is the endpoint group it belongs to.
Endpoint metadata is declared as public properties so it can be required by the interface and applied by EndpointMapper.
using Microsoft.AspNetCore.Http;
using PANiXiDA.Core.Presentation.Http.Endpoints;
public sealed class GetOrderEndpoint : IEndpoint<OrdersEndpointGroup>
{
public string Route { get; } = "/{id:guid}";
public string Name { get; } = "GetOrder";
public string Summary { get; } = "Gets an order by identifier.";
public void Map(EndpointMapBuilder builder)
{
builder.MapGet((Guid id) =>
{
return TypedResults.Ok(new OrderResponse(id));
});
}
}
public sealed record OrderResponse(Guid Id);
Result Mapping
Successful results are mapped through the provided success factory.
using Microsoft.AspNetCore.Http;
using PANiXiDA.Core.Presentation.Http.Helpers;
using PANiXiDA.Core.ResultPattern;
public static IResult GetOrder(Guid id)
{
Result<OrderResponse> result = Result.Success(new OrderResponse(id));
return result.ToHttpResult(value =>
{
return TypedResults.Ok(value);
});
}
Failed results are mapped to ProblemDetails or ValidationProblem.
using Microsoft.AspNetCore.Http;
using PANiXiDA.Core.Presentation.Http.Helpers;
using PANiXiDA.Core.ResultPattern;
public static IResult CreateOrder()
{
Result result = Result.Failure(Error.Validation("Email is required").WithField("Email"));
return result.ToHttpProblem();
}
HTTP Error Mapping
Unhandled exceptions are mapped to ProblemDetails in every environment.
In Development, the response includes the exception message in detail.
| Error type | HTTP status | Title |
|---|---|---|
Validation |
400 | One or more validation errors occurred. |
NotFound |
404 | Resource not found |
Conflict |
409 | Conflict |
Unauthorized |
401 | Unauthorized |
Forbidden |
403 | Forbidden |
Failure |
400 | Request failed |
Unexpected |
500 | Server error |
Validation error fields are used as ValidationProblem keys. If a validation error has no field, the key is general.
OpenAPI
In Development, UseHttp exposes:
- OpenAPI document at
/openapi/v1.json; - Scalar API reference at
/scalar.
OpenAPI registration also enables Scalar transformers for Scalar-specific document extensions.
Module documents
Applications composed from multiple presentation modules can expose one OpenAPI document per module.
Register the presentation assemblies in code and configure their document names and display titles in appsettings.json.
UseHttp automatically maps endpoint groups from registered module assemblies.
using PANiXiDA.Core.Presentation.Http.DependencyInjection;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHttp(
builder.Configuration,
typeof(IdentityPresentationAssembly).Assembly,
typeof(CompendiumPresentationAssembly).Assembly);
var app = builder.Build();
app.UseHttp();
app.Run();
Each key under HttpModules must match the simple name returned by Assembly.GetName().Name.
Both Name and Title are required for every registered module assembly.
{
"HttpModules": {
"PANiXiDA.TacticalHeroes.Identity.Presentation": {
"Name": "identity",
"Title": "Identity API"
},
"PANiXiDA.TacticalHeroes.Compendium.Presentation": {
"Name": "compendium",
"Title": "Compendium API"
}
}
}
This configuration exposes:
/openapi/identity.jsonfor Identity endpoints;/openapi/compendium.jsonfor Compendium endpoints;/scalarwith a document selector for both modules.
OpenAPI documents are filtered by module metadata while API version metadata remains independent.
Document names are compared case-insensitively, and a presentation assembly can belong to only one module.
When no modules are registered, the existing combined /openapi/v1.json document remains the default.
The Scalar browser tab title can be configured from application configuration. If the title is not configured or is blank, Scalar uses its default document title.
{
"ScalarConfiguration": {
"Title": "Orders API Reference"
}
}
OpenAPI is not mapped automatically outside Development.
API Versioning
The package configures URL segment API versioning:
/api/v1/orders
The default API version is 1.0, and the version must be present in the route.
Project Structure
src/
PANiXiDA.Core.Presentation.Http/
Configurations/
DependencyInjection/
Endpoints/
Helpers/
Middlewares/
tests/
PANiXiDA.Core.Presentation.Http.UnitTests/
Development
Run the standard validation before publishing:
dotnet restore
dotnet format
dotnet build --configuration Release
dotnet test --configuration Release
dotnet pack --configuration Release
Run coverage:
dotnet test --configuration Release -- --coverage --coverage-output coverage.xml --coverage-output-format xml
The source files under src/PANiXiDA.Core.Presentation.Http are covered by unit tests. Coverage excludes generated files under obj/ from ASP.NET Core and validation source generators.
Package Contents
The NuGet package includes:
- compiled library for
net10.0; - XML documentation;
- README;
- package icon;
- Source Link metadata;
- symbols package when packed with repository settings.
License
This project is licensed under the Apache-2.0 license. See LICENSE for details.
| 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.Http (>= 10.0.1)
- Asp.Versioning.OpenApi (>= 10.0.1)
- Microsoft.AspNetCore.OpenApi (>= 10.0.10)
- PANiXiDA.Core.ResultPattern (>= 1.0.2)
- Scalar.AspNetCore (>= 2.16.17)
- Scalar.AspNetCore.Microsoft (>= 2.16.17)
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 |
|---|---|---|
| 2.0.8 | 0 | 8/2/2026 |
| 2.0.7 | 0 | 8/2/2026 |
| 2.0.6 | 0 | 8/2/2026 |
| 2.0.5-preview | 127 | 6/22/2026 |
| 2.0.4-preview | 68 | 6/19/2026 |
| 2.0.3-preview | 75 | 6/18/2026 |
| 2.0.2-preview | 98 | 6/14/2026 |
| 2.0.1-preview | 78 | 6/13/2026 |
| 1.0.3-preview | 71 | 6/12/2026 |
| 1.0.2-preview | 66 | 5/21/2026 |