How to mark api parameter as optional for Swagger UI for Web API 2?
<p>I am using Swagger for WebApi 5.5.3 nuget package for API documentation. In swagger UI it is showing required option for optional parameter. </p>

<p>I tried XML comment option in Visual studio. Below is the API method that i want to document:</p>

<pre><code>    /// &lt;summary&gt;
    /// Gets the history.
    /// &lt;/summary&gt;
    /// &lt;param name="currentPageIndex"&gt;Index of the current page.&lt;/param&gt;
    /// &lt;param name="pageSize"&gt;Size of the page.&lt;/param&gt;
    /// &lt;param name="lastSyncDate"&gt;The last synchronize date.&lt;/param&gt;
    /// &lt;returns&gt;&lt;/returns&gt;
    [HttpGet]
    [Route("GetHistory/{currentPageIndex}/{pageSize}")]
    public IHttpActionResult GetHistory(int currentPageIndex, int pageSize, DateTime? lastSyncDate)
    {
        var response = _myRepo.GetData();
        if (response == null)
            return BadRequest(Messages.InvalidPageIndex);

        return Ok(response);
    }
</code></pre>

<p>It is showing lastSyncDate as query parameter but it is required while I have marked it as nullable parameter. </p>

<p>I have also tried making currentPageIndex as nullable in xml as well as route but still all the properties as showing as required. Please help.</p>