From da70e6f5bbb5d12f54aaabaeabe3bfb778026b63 Mon Sep 17 00:00:00 2001 From: Scott Xu Date: Fri, 9 Jun 2023 16:17:43 +0800 Subject: [PATCH] Update SchemaExtensions.cs Set schema's description only if has SwaggerDescriptionAttribute applied and the description is not null, in case overwrite the description from custom SchemaFilter or ModelFilter --- Swagger.Net/Swagger/Extensions/SchemaExtensions.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Swagger.Net/Swagger/Extensions/SchemaExtensions.cs b/Swagger.Net/Swagger/Extensions/SchemaExtensions.cs index ca1dcd0..6c9ec02 100644 --- a/Swagger.Net/Swagger/Extensions/SchemaExtensions.cs +++ b/Swagger.Net/Swagger/Extensions/SchemaExtensions.cs @@ -89,7 +89,10 @@ public static Schema WithDescriptionProperty(this Schema schema, JsonProperty js return schema; var attrib = propInfo.GetCustomAttributes(false).OfType().FirstOrDefault(); - schema.description = attrib?.Description; + var description = attrib?.Description; + if (description != null) + schema.description = description; + return schema; }