title: How to use [FromHeader] attribute with custom model binding in Asp.Net Core 2.2
body: <p>I need to add many custom headers in my request. I can use something like this</p>
  
  <pre><code>public ActionResult Get([FromHeader, Required]string header1, [FromHeader]string  header2, ... , [FromHeader]string headerx)
  {
  ...
  ...
  }
  </code></pre>
  
  <p>I am not sure if it is good to use that number of parameters in one method.
  I would like to use something like this</p>
  
  <pre><code>public class HeaderParameters 
  {
    [Required]
    public string Header1 { get; set; }
    public string Header2 { get; set; }
    ...
    public string Headerx { get; set; }
  }
  
  public ActionResult Get([FromHeader]HeaderParameters headerParameters)
  {
    ...
    ...
  }
  </code></pre>
  
  <p>But it doesn't work.</p>
  
  <p>If I use [FromHeader] attribute for each property of HeaderParameters class Swagger is acting weird. </p>
  
  <p><a href="http://prntscr.com/p14kd7" rel="noreferrer">Request example http://prntscr.com/p14kd7</a></p>
  
  <pre><code>{
    "errors": {
      "Device": [
        "The Header1 field is required."
      ]
    },
    "title": "One or more validation errors occurred.",
    "status": 400,
    "traceId": "0HLPG9SNNJ1U2:00000001"
  }
  </code></pre>