OpenAPI spec allows to define different types for different content types.
It would be nice to generate something like that for this case:
type SomeMethodBodyInput =
| SomeMethodBodyJson of SomeMethodJsonBodyInput
| SomeMethodBodyFormUrlEncoded of SomeMethodFormUrlEncodedBodyInput
//...
match ctx.Request.Headers.ContentType with
| "text/json" ->
let! json = ctx.bindJsonAsync<SomeMethodJsonBodyInput>()
json
//...
|> SomeMethodBodyJson
|> Ok
//...
| unsupported -> UnsupportedBodyContentType unsupported |> BodyBindingError |> Error
OpenAPI spec allows to define different types for different content types.
It would be nice to generate something like that for this case: