Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validateEveryToJSON ignores new response handlers #1489

Open
mossprescott opened this issue Nov 23, 2021 · 1 comment
Open

validateEveryToJSON ignores new response handlers #1489

mossprescott opened this issue Nov 23, 2021 · 1 comment

Comments

@mossprescott
Copy link

mossprescott commented Nov 23, 2021

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 (haskell-servant/servant-swagger#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:

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

@mossprescott
Copy link
Author

cc @rukav @ystael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant