From 22c35a39c3d3ee1e6da9fa9e929db2cb8526c723 Mon Sep 17 00:00:00 2001 From: Ionwyn Sean Date: Mon, 12 Aug 2024 12:12:58 -0700 Subject: [PATCH] Ensure schema ID is polymorphism-aware --- api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs b/api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs index 11dda759..1e283893 100644 --- a/api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs +++ b/api/Hmcr.Api/Extensions/IServiceCollectionExtensions.cs @@ -129,6 +129,9 @@ public static void AddHmcrSwagger(this IServiceCollection services, IWebHostEnvi var filePath = Path.Combine(System.AppContext.BaseDirectory, "Hmcr.Api.xml"); options.IncludeXmlComments(filePath); + // Ensure swagger is aware of namespace and class hierarchy, replacing occurrences of such cases with . for readability. + options.CustomSchemaIds(type => type.FullName.Replace('+', '.')); + var securitySchema = new OpenApiSecurityScheme { Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",