Microsoft Web API Help Page - How to Create Annotations for Parameters

I recently started playing with the new api webpage page features that were recently added to the api web project template. And I noticed that in the "More Information" column is always "no."

enter image description here

After some consideration of the markup, I found that this information should come from attributes

<td class="parameter-annotations"> @if (parameter.Annotations.Count > 0) { foreach (var annotation in parameter.Annotations) { <p>@annotation.Documentation</p> } } else { <p>None.</p> } </td> 

But what attribute should I use to fill out additional information? Thanks

+5
source share
1 answer

See this site for an example of how to add more information.

It basically annotates your model, so in your case it will be something like: -

 public class Product { /// <summary> /// The id of the product /// </summary> [Required] public int Id { get; set; } /// <summary> /// The name of the product /// </summary> [MaxLength(50)] public string Name { get; set; } } 

What will give you this conclusion: -

example output

+9
source

Source: https://habr.com/ru/post/1203605/


All Articles