Skip to content

Commit

Permalink
Generate documentation comments for all annotation documentation mark…
Browse files Browse the repository at this point in the history
…up elements, instead of just the first one
  • Loading branch information
shaynevanasperen committed Oct 18, 2023
1 parent 4539c1e commit 799e995
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions XmlSchemaClassGenerator/ModelBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1075,12 +1075,13 @@ public IEnumerable<Particle> GetElements(XmlSchemaObject item, XmlSchemaObject p

public static List<DocumentationModel> GetDocumentation(XmlSchemaAnnotated annotated)
{
return annotated.Annotation == null ? new List<DocumentationModel>()
: annotated.Annotation.Items.OfType<XmlSchemaDocumentation>()
.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<DocumentationModel>()
: annotated.Annotation.Items.OfType<XmlSchemaDocumentation>()
.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<CodeNamespace> GenerateCode()
Expand Down

0 comments on commit 799e995

Please sign in to comment.