skip to Main Content

FromHeader only has a Name property and doesn’t have description. How do I change the description?

public async Task<IActionResult> Test([FromHeader] string Authorization)
{
}

enter image description here

2

Answers


  1. You should include the using System.ComponentModel then add an annotation to the controller method like this:

    [Description("This description will appear in docs")]
    [HttpPost]
    public async Task<IActionResult> Test([FromHeader] string Authorization)
            {
           }
    

    Hope help you.

    Login or Signup to reply.
  2. Updated your csproj to use xml documentation:
    enter image description here

    Update your program.cs
    enter image description here

    Then your xml comments will show, like mine:
    enter image description here

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search