haskell-servant / haskell-servant/servant-swagger

Which content type to prefer for swagger docs?

Open
#13 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
123
Forks
34
PR merge metrics
No merged PRs in 30d

Description

Suppose this API:

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how the SampleAPI content types are translated into Swagger Schema and formData parameters. Compare the handling of JSON, FormUrlEncoded, and XML, including duplicate paths, and define the expected single-content-type behavior before making a change. Done means the selected representation is consistent with the Swagger specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.