Skip to content

Commit

Permalink
feat: Document timespan in api
Browse files Browse the repository at this point in the history
Correctly document timespan model in the api documentation.
  • Loading branch information
LuukvH committed Jul 15, 2024
1 parent 4d4a071 commit d70632b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Services/Scheduling/Api/ConfigureServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -26,6 +27,14 @@ public static IServiceCollection AddApiServices(this IServiceCollection services
Email = "[email protected]",
},
});

// Add a custom schema filter to handle TimeSpan as string with time format
options.MapType<TimeSpan>(() => new OpenApiSchema
{
Type = "string",
Format = "time",
Example = new OpenApiString("14:30:00")
});
});

services.AddHealthChecks();
Expand Down

0 comments on commit d70632b

Please sign in to comment.