From 799e9951411e24e256efd9466fc04d27ed6e14f7 Mon Sep 17 00:00:00 2001 From: Shayne van Asperen Date: Wed, 18 Oct 2023 18:32:53 +0100 Subject: [PATCH] Generate documentation comments for all annotation documentation markup elements, instead of just the first one --- XmlSchemaClassGenerator/ModelBuilder.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/XmlSchemaClassGenerator/ModelBuilder.cs b/XmlSchemaClassGenerator/ModelBuilder.cs index 390e10e3..0429ff1d 100644 --- a/XmlSchemaClassGenerator/ModelBuilder.cs +++ b/XmlSchemaClassGenerator/ModelBuilder.cs @@ -1075,12 +1075,13 @@ public IEnumerable GetElements(XmlSchemaObject item, XmlSchemaObject p public static List GetDocumentation(XmlSchemaAnnotated annotated) { - return annotated.Annotation == null ? new List() - : annotated.Annotation.Items.OfType() - .Where(d => d.Markup?.Length > 0) - .Select(d => new DocumentationModel { Language = d.Language, Text = new XText(d.Markup[0].InnerText).ToString() }) - .Where(d => !string.IsNullOrEmpty(d.Text)) - .ToList(); + return annotated.Annotation == null ? new List() + : annotated.Annotation.Items.OfType() + .Where(d => d.Markup?.Length > 0) + .Select(d => d.Markup.Select(m => new DocumentationModel { Language = d.Language, Text = new XText($"{m.Name}: {m.InnerText}").ToString() })) + .SelectMany(d => d) + .Where(d => !string.IsNullOrEmpty(d.Text)) + .ToList(); } public IEnumerable GenerateCode()