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

Double `Maybe` for a QueryParam?

Open saurabhnanda opened this issue 7 years ago • 1 comments

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?

saurabhnanda avatar Jun 19 '18 01:06 saurabhnanda

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.

mattjbray avatar Jul 08 '18 19:07 mattjbray