question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

<summary> xml annotation not working for properties in nested objects

See original GitHub issue

Assuming we have a model called Group that looks like this:

    public class Group{
      ///<summary>
      /// Some description of GroupName
      ///</summary>
      public string GroupName{get;set;}
      public List<Person> People {get;set;} 
    }

and a Person class that looks like this:

    public class Person{
      ///<summary>
      /// Some description of Name
      ///</summary>
      public string Name{get;set;}
    }

If we then use the ResponeType attribute for an API action and set it to typeof(Group) the resulting documentation for the action will only show the descriptions in the

element for the top level properties (GroupName, for ex). The description in the

element of the nested Person class (for Name) is not reflected in the generated documentation.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

12reactions
luboshlcommented, Jul 26, 2017

I am using version 5.6.0 and multiple XML docs works for me:

var dir = new DirectoryInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin"));
foreach (var fi in dir.EnumerateFiles("*.xml"))
{
    c.IncludeXmlComments(fi.FullName);
}
0reactions
lonix1commented, Oct 22, 2021

@luboshl’s solution works in aspnet core 5:

var dir = AppContext.BaseDirectory;
var paths = Directory.GetFiles(dir, "*.xml", SearchOption.TopDirectoryOnly);
foreach (var path in paths) o.IncludeXmlComments(path);

@domaindrivendev Should be added to the docs, this issue is the only place it’s discussed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

<summary> xml annotation not working for properties in ...
In the "model schema" portional of the UI, the xml summaries for nested parameters do not appear. Happy to create a separate issue...
Read more >
Show descriptions for model properties which are custom ...
Reference: Nested Models Missing Descriptions and <summary> xml annotation not working for properties in nested objects.
Read more >
Solving the XML Problem with Jackson
Looking for a mature, flexible way of working with both JSON and XML for the same data? Read how the Jackson XML module...
Read more >
Examples of XML Serialization
If a property or field returns a complex object (such as an array or a class instance), the XmlSerializer converts it to an...
Read more >
All You Need To Know About JSON Parsing With Jackson
@JsonAnyGetter. This annotation allows us to treat a Map object as a source of JSON properties. Say we have this map as a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found