Closed DaleyKD closed 4 years ago
Man, you're going to hate me. :)
Using more than one .xml file may result in a string.Empty enum description.
string.Empty
services.AddSwaggerGen(options => { options.SwaggerDoc("v1", apiInfo); options.UseAllOfToExtendReferenceSchemas(); var xmlFiles = Directory.GetFiles(AppContext.BaseDirectory, "*.xml", SearchOption.TopDirectoryOnly); foreach (var xmlFile in xmlFiles) { options.IncludeXmlComments(xmlFile); } options.AddEnumsWithValuesFixFilters(services, o => { o.IncludeDescriptions = true; o.DescriptionSource = DescriptionSources.DescriptionAttributesThenXmlComments; foreach (var xmlFile in xmlFiles) { o.IncludeXmlCommentsFrom(xmlFile); } }); });
https://github.com/unchase/Unchase.Swashbuckle.AspNetCore.Extensions/blob/a3d1193ce9546cde4e15e39c6f4af27cb577a996/src/Unchase.Swashbuckle.AspNetCore.Extensions/Extensions/EnumTypeExtensions.cs#L105
This returns out after the first iteration and won't check any of the other XPath Navigators.
Replace that line with:
if (xpathNavigator2 != null) { return XmlCommentsTextHelper.Humanize(xpathNavigator2.InnerXml); }
Hi, @DaleyKD
Agree with you. Thanks for your feedback! It helps to improve the library.
Man, you're going to hate me. :)
SYMPTOM
Using more than one .xml file may result in a
string.Empty
enum description.REPRODUCTION
CAUSE
https://github.com/unchase/Unchase.Swashbuckle.AspNetCore.Extensions/blob/a3d1193ce9546cde4e15e39c6f4af27cb577a996/src/Unchase.Swashbuckle.AspNetCore.Extensions/Extensions/EnumTypeExtensions.cs#L105
This returns out after the first iteration and won't check any of the other XPath Navigators.
SOLUTION
Replace that line with: