From a203c2b6d1c36d113c1412041b7d279d404b2276 Mon Sep 17 00:00:00 2001 From: honzapatCZ Date: Sat, 11 Jan 2025 19:36:51 +0100 Subject: [PATCH] missed IApiDescriptionVisibility for oneOf, allOf, anyOf --- .../IApiDescriptionVisibilitySchemaFilter.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Controllers/IApiDescriptionVisibilitySchemaFilter.cs b/Controllers/IApiDescriptionVisibilitySchemaFilter.cs index be05efe..8d95262 100644 --- a/Controllers/IApiDescriptionVisibilitySchemaFilter.cs +++ b/Controllers/IApiDescriptionVisibilitySchemaFilter.cs @@ -39,7 +39,7 @@ namespace NejCommon.Controllers var key = context.SchemaRepository.Schemas.FirstOrDefault(k => k.Value == schema).Key; if (string.IsNullOrWhiteSpace(key)) continue; - //Console.WriteLine($"Removing schema {key}"); + Console.WriteLine($"Removing schema {key}"); context.SchemaRepository.Schemas.Remove(key); } } @@ -86,7 +86,7 @@ namespace NejCommon.Controllers var orphanedSchemas = swaggerDoc.Components.Schemas.Where(x => !currentSchemas.ContainsKey(x.Key)).ToDictionary(x => x.Key, x => x.Value); - //Console.WriteLine($"Unused schemas: {string.Join(", ", orphanedSchemas.Keys)}"); + Console.WriteLine($"Unused schemas: {string.Join(", ", orphanedSchemas.Keys)}"); swaggerDoc.Components.Schemas = swaggerDoc.Components.Schemas.Where(x => currentSchemas.ContainsKey(x.Key)).ToDictionary(x => x.Key, x => x.Value); } @@ -113,6 +113,18 @@ namespace NejCommon.Controllers { ExpandSchemas(repo, currentSchemas, sch); } + foreach(var sch in schemaToExpand.OneOf) + { + ExpandSchemas(repo, currentSchemas, sch); + } + foreach(var sch in schemaToExpand.AnyOf) + { + ExpandSchemas(repo, currentSchemas, sch); + } + foreach(var sch in schemaToExpand.AllOf) + { + ExpandSchemas(repo, currentSchemas, sch); + } } } } \ No newline at end of file