haskell-servant / haskell-servant/servant

validateEveryToJSON ignores new response handlers

Open
#1,489 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
2k
Forks
427
Avg merge
2d 23h
Merged PRs (30d)
5

Description

`validateEveryToJSON` silently ignores any endpoints in the API type that use anything other than the built-in `Verb` and `ReqBody` types. See below for context.

_Note:_ this issue was originally reported against in the servant-swagger repo (https://github.com/haskell-servant/servant-swagger/issues/68), with some comments in favor of fixing it. As far as I can tell, the same code exists in the PR merging the code into this repo:
https://github.com/haskell-servant/servant/blob/fed9e99a99d2ca113a0b8d012921782ff93c563f/servant-swagger/src/Servant/Swagger/Internal/TypeLevel/API.hs#L85

Reporting the issue here for (re-)consideration.

> 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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.