-
Notifications
You must be signed in to change notification settings - Fork 11
Add context to prepareRoutes #121
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
Conversation
import Core.Webserver.Warp | ||
import Data.Proxy (Proxy) | ||
import GHC.Base (Type) | ||
import Network.Wai (Application) | ||
import Servant (Handler (..), ServerT) | ||
import Servant.Server (HasServer, hoistServer, serve) | ||
import Core.Telemetry.Observability (clearMetrics) | ||
import Servant.Server (Context (..), HasServer, ServerContext, serveWithContextT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point should we make this a qualified import (Servant.
presumably), mirroring the pattern elsewhere in this family of libraries? [rather than having to be explicit about Core.Program.Context.Context below]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jack-davies sent you jack-davies#1
prepareRoutes proxy (routes :: ServerT api (Program τ)) = | ||
prepareRoutes proxy = prepareRoutesWithContext proxy EmptyContext | ||
|
||
prepareRoutesWithContext :: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want this part of the public API we should add a Haddock documentation, even if it just has
{-|
Prepare routes as above, but providing a Context.
@since 0.1.1
-}
in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I can do these things if you're busy)
Use qualified imports for servant
These changes look sensible. I think this is good to go @istathar! |
Implement
prepareRoutesWithContext
to align with servant'sserveWithContext
. Required for servant-auth.