title: ASP.NET Core 2.0 - Web API Method Multiple Endpoints
body: <p>This is my controller:</p>
  
  <pre><code>[Route("api/[controller]")]
  public class SaveRecordController : XivicControllerBase
  {
      #region REST Calls
      [HttpPost]
      public SaveRecordResponse Post([FromBody] SaveRecordRequest saveRecordRequest)
      {
          var retVal = new SaveRecordResponse();
          try
          {
              ValidateRequest(saveRecordRequest);
  
              //Save logic here [...]
  
          }
          catch (Exception ex)
          {
              Logger.Log(ex);
              retVal.Errors.Add(new XivicError(ex.Message));
          }
  
          return retVal;
      }
      #endregion
  }
  </code></pre>
  
  <p>It takes any entity, attempts to save it, and then returns the Id of the entity saved, or a collection of errors. Swashbuckle serves up the Swagger UI like so:</p>
  
  <p><a href="https://i.stack.imgur.com/B8ush.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B8ush.png" alt="enter image description here"></a></p>
  
  <p>This works fine, but this is not what I want to expose to 3rd party integrators. I want to create multiple endpoints that are generated dynamically based on the configuration in the system of what Record types (Entities) are exposed externally). So, for example, if client x has an entity called "Job", there would be an action called SaveJob, and this would show up in the Swagger documentation. </p>
  
  <p>If I add a new HttpPost attributes, I can get the new endpoint like so:</p>
  
  <pre><code>    [HttpPost]
      [HttpPost("SaveJob")]
      public SaveRecordResponse Post([FromBody] SaveRecordRequest saveRecordRequest)
      {
      }
  </code></pre>
  
  <p>This does show up in Swagger as I would expect it to, but here comes the rub...</p>
  
  <p>I cannot add attributes to the class SaveRecordController because it is a core type inside our core application assembly. External entities(record types) are defined at runtime. They are not actual types inside the application. So I don't know how to add the endpoints dynamically at runtime. I guess there are some routing options in ASP.NET Core 2.0, but the Swashbuckle documentation explicitly says </p>
  
  <blockquote>
    <p>Additionally, if you are using conventional routing (as opposed to
    attribute routing), any controllers and the actions on those
    controllers that use conventional routing will not be represented in
    ApiExplorer, which means Swashbuckle won't be able to find those
    controllers and generate Swagger documents from them.</p>
  </blockquote>
  
  <p>So the doco would not get generated properly. I'm stuck. What should I do?</p>