OpenAPI-document van de SlpSoftware-host vastgelegd met snapshot-test en contactcontract

openapi/slpsoftware.v1.json is de bron voor de gegenereerde frontend-types; een test haalt het document van de echte host op en faalt bij afwijking (UPDATE_OPENAPI=1 herschrijft het bestand). De contactmodule voegt de herbruikbare foutresponses, de verplichte Idempotency-Key en de verplichte velden met maximale lengtes toe via een documenttransformer, zodat Core ongemoeid blijft.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 13:07:28 +01:00
co-authored by Claude Sonnet 5.5
parent ce06fad727
commit f8d45eef54
9 changed files with 1968 additions and 13 deletions
@@ -1,6 +1,7 @@
using System.Diagnostics.CodeAnalysis;
using System.Threading.RateLimiting;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.OpenApi;
using Microsoft.AspNetCore.RateLimiting;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Migrations;
@@ -13,6 +14,7 @@ using SlpModularCms.Core.Modules;
using SlpModularCms.Modules.Contact.Config;
using SlpModularCms.Modules.Contact.Controllers;
using SlpModularCms.Modules.Contact.Data;
using SlpModularCms.Modules.Contact.OpenApi;
using SlpModularCms.Modules.Contact.Repositories;
using SlpModularCms.Modules.Contact.Services;
@@ -47,6 +49,10 @@ public class ContactModule : IModule
services.AddScoped<ContactRouteFilter>();
services.AddHostedService<ContactRetentionService>();
// The contact details of the OpenAPI document (named options of document 'v1', so the shared
// AddOpenApi() call in Core stays untouched).
services.Configure<OpenApiOptions>("v1", openApi => openApi.AddDocumentTransformer<ContactOpenApiDocumentTransformer>());
// Rate-limit policies live in this module so the shared limiter setup stays untouched.
// The bucket key comes from one function; see ContactRateLimitPartition.
services.AddOptions<RateLimiterOptions>()