title: Multiple optional parameters including enum type in ASP.NET Core Web API routing
body: <p>I am creating a method in my ASP.NET Core Web Api that takes multiple parameters, all of which are optional. I am getting an error while calling this method on postman:</p>
  
  <pre><code>System.InvalidOperationException: The constraint reference 'StatusEnum' could not be resolved to a type. Register the constraint type with 'Microsoft.AspNetCore.Routing.RouteOptions.ConstraintMap'
  </code></pre>
  
  <p>How can I work with enums as my param type in routing?
  My controller:</p>
  
  <pre><code>[HttpPost("filter-reports/{reportStatus:StatusEnum?}/{IsNecessary:bool?}/{completionStatus: completionStatusEnum?}")]
      [Authorize]
      public ObjectResult GetDamageReportByFilters(StatusEnum? reportStatus, bool? IsNecessary, completionStatusEnum? completionStatus)
      {
          var result = _reportService.GetReportByFilters(reportStatus,IsNecessary, completionStatus);
  
          return StatusCode(200, result);
      }
  </code></pre>
  
  <p>How can I fix this?</p>