servant-swagger icon indicating copy to clipboard operation
servant-swagger copied to clipboard

Which content type to prefer for swagger docs?

Open fizruk opened this issue 9 years ago • 3 comments

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).

fizruk avatar Jan 09 '16 11:01 fizruk

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).

dmjio avatar Jan 09 '16 15:01 dmjio

There are APIs returning JSON, YAML and EDN...

phadej avatar Feb 01 '17 16:02 phadej

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!

akhesaCaro avatar Nov 17 '21 11:11 akhesaCaro