haskell-servant / haskell-servant/servant-swagger

validateEveryToJSON ignores new response handlers

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

Description

We’ve implemented a new handler (for streaming responses) by providing instances of `HasServer`, `HasClient`, `Accept`, and `HasSwagger`. This works reasonably well, but now we've run into an issue where the type-level machinery used by `validateEveryToJSON` (i.e. `BodyTypes`) can’t be extended in a similar way, and in fact it silently ignores endpoints that use the new type. I don’t know if this approach _can_ be made to handle this, but it would be an improvement if it at least gave an error saying that it can’t discover all the types.

The problem is the “default” case on this line:
https://github.com/haskell-servant/servant-swagger/blob/735657be74c1fb701c18d6eeac4d3b2ba23b66e1/src/Servant/Swagger/Internal/TypeLevel/API.hs#L81

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/Servant/Swagger/Internal/TypeLevel/API.hs around the default case at line 81, then trace how BodyTypes is used by validateEveryToJSON. Reproduce the behavior with an endpoint using the new response handler and determine how unsupported types should be reported. Done means such endpoints are no longer silently ignored and instead produce a clear error or an agreed limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
api, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.