haskell-servant / servant-elm

Automatically derive Elm functions to query servant webservices
BSD 3-Clause "New" or "Revised" License
164 stars 48 forks source link

Double `Maybe` for a QueryParam? #41

Closed saurabhnanda closed 7 months ago

saurabhnanda commented 6 years ago

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?

mattjbray commented 6 years ago

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.