Share your Ktor endpoints between client and server spine.opensavvy.dev
rest http ktor kotlin arrow

merge: Use correct generics in routeWithRaise methods master

I ran into an issue while integrating Spine into my project (more specifically, the `server-arrow` module). It seems that the `routeWithRaise` methods can never apply because of a star-projection in the method signature. Replacing it with `Never` seems to do the trick. After adding unit tests to the module (copy/pasted from the `server` module, but making use of the `routeWithRaise` method instead of `route` and `raise`/`ensure` instead of `fail`), I encountered another issue. It seems that declaring failures with the `fun <S : FailureSpec> failure(spec: S)` overload causes issue when calling the \``routeWithRaise`\` method because it can't seem to resolve the failure back to its original type (for example in the unit tests, an endpoint with the `NotFound` failure will resolve to a `NotFound.Companion` but not to a `FailureSpec.ByCode<NotFound>`, which makes it impossible to use the `routeWithRaise` for that endpoint). To solve that second issue I added an overload to the `failure` which specifically takes a `FailureSpec.ByCode<F>` as parameter. I did not find an easier way to make this work, so let me know if you have any suggestions. See merge request opensavvy/groundwork/spine!89


+251 -18
3 changed files