Skip to content

Commit

Permalink
Merge pull request #432 from shaynevanasperen/master
Browse files Browse the repository at this point in the history
Generate documentation comments for all annotation documentation mark…
  • Loading branch information
mganss authored Oct 23, 2023
2 parents 4539c1e + 799e995 commit a29c835
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 a29c835

Please sign in to comment.