servant-swagger
servant-swagger copied to clipboard
Which content type to prefer for swagger docs?
Suppose this API:
type SampleAPI = "sample" :> Get '[JSON, FormUrlEncoded, XML] Sample
Should we use a body
param with Swagger Schema or formData
params?
With swagger spec it does not seem to make sense having both.
It also appears we can't have duplicate paths with different params.
I tend to think that we should just pick the first content type of the list (if any).
The other option might be to pick one of the most precedence (e.g. prefer JSON
then FormUrlEncoded
).
Highest precedence sounds good (or first). I think this will be a corner case. I've never come across an API that returned both JSON and FormUrlEncoded data (although I have seen (X)HTML and JSON).
There are APIs returning JSON, YAML and EDN...
Hi, Servant-swagger will be moved into the main Servant repo (see : https://github.com/haskell-servant/servant/pull/1475) If this issue is still relevant, would it be possible for you to summit it there? : https://github.com/haskell-servant/servant/issues
Thanks in advance!