servant-elm
servant-elm copied to clipboard
Double `Maybe` for a QueryParam?
Here's what my routes look like (using servant-generic):
data Routes route = Routes
{ rTest :: route :- "test" :> Get '[JSON] Text
, rOAuthReturn :: route :- "oauth-return" :> QueryParam "code" Text :> Get '[JSON] Text
} deriving (Generic)
Here's the function that handles rOAuthReturn:
oauthReturn :: Maybe Text -> AppM Text
oauthReturn = -- some code
The generated Elm type-signature for this API was:
getOauthreturn : Maybe (Maybe (String)) -> Http.Request (String)
getOauthreturn query_code = -- some code
Is this correct?
Can you check you're using the latest version of servant-elm? I believe this was fixed in https://github.com/mattjbray/servant-elm/pull/31.