title: Using optional query parameters in F# Web Api project
body: <p>I was converting a C# webapi project to F# using the F# ASP.NET templates. Everything is working great except optional query parameters. I keep getting this error</p>
  
  <pre><code>{
      "message": "The request is invalid.",
      "messageDetail": "The parameters dictionary contains an invalid entry for parameter 'start' for method 'System.Threading.Tasks.Task`1[System.Net.Http.HttpResponseMessage] GetVendorFiles(Int32, System.Nullable`1[System.DateTime])' in 'Thor.WebApi.VendorFilesController'. The dictionary contains a value of type 'System.Reflection.Missing', but the parameter requires a value of type 'System.Nullable`1[System.DateTime]'."
  }
  </code></pre>
  
  <p>F# function signature:</p>
  
  <pre><code>[&lt;HttpGet; Route("")&gt;]
  member x.GetVendorFiles( [&lt;Optional; DefaultParameterValue(100)&gt;] count, [&lt;Optional; DefaultParameterValue(null)&gt;] start : Nullable&lt;DateTime&gt; ) =
  </code></pre>
  
  <p>C# function signature:</p>
  
  <pre class="lang-cs prettyprint-override"><code>[HttpGet]
  [Route("")]
  public async Task&lt;HttpResponseMessage&gt; GetVendorFiles(int count = 100,DateTime? start = null)
  </code></pre>
  
  <p>Does anyone know of any workarounds?</p>
  
  <p><strong>Updated:</strong>
  I figured out the cause of this issue. ASP.NET extracts default values for controller actions <a href="https://github.com/ASP-NET-MVC/aspnetwebstack/blob/0ee98f84b41b6bef6bde6945e2797de9dac7d48a/src/System.Web.Http/Controllers/ReflectedHttpParameterDescriptor.cs#L37">using ParameterInfo</a>. Apparently the F# compiler doesn't compile default values the same way as C# does (even with the <code>DefaultParameterValueAttribute</code>)</p>
  
  <p>What's the best way or working around this? Would it be some filter that I need to inject or implement my own <code>ParameterBinding</code>?</p>