From d70632b9d97a64eea1df00bebacbbf5144332024 Mon Sep 17 00:00:00 2001 From: LuukvH Date: Mon, 15 Jul 2024 22:07:30 +0200 Subject: [PATCH] feat: Document timespan in api Correctly document timespan model in the api documentation. --- src/Services/Scheduling/Api/ConfigureServices.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Services/Scheduling/Api/ConfigureServices.cs b/src/Services/Scheduling/Api/ConfigureServices.cs index 6b78ccba..7a72dc1a 100644 --- a/src/Services/Scheduling/Api/ConfigureServices.cs +++ b/src/Services/Scheduling/Api/ConfigureServices.cs @@ -2,6 +2,7 @@ using KDVManager.Services.Scheduling.Application.Contracts.Services; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Any; namespace Microsoft.Extensions.DependencyInjection; @@ -26,6 +27,14 @@ public static IServiceCollection AddApiServices(this IServiceCollection services Email = "admin@kdvmanager.nl", }, }); + + // Add a custom schema filter to handle TimeSpan as string with time format + options.MapType(() => new OpenApiSchema + { + Type = "string", + Format = "time", + Example = new OpenApiString("14:30:00") + }); }); services.AddHealthChecks();