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

validateEveryToJSON ignores new response handlers

Open mossprescott opened this issue 7 years ago • 3 comments

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 avatar Jul 12 '17 21:07 mossprescott

@fizruk should we make it extendable similarly as IsElem for safeLink is?

phadej avatar Jul 12 '17 21:07 phadej

@phadej definitely!

fizruk avatar Oct 17 '17 13:10 fizruk

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