Skip to content
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

[Haskell] Fix broken client/server compilation errors #5097

Merged
merged 7 commits into from
Mar 17, 2017
Prev Previous commit
Next Next commit
Fix failing pattern matching for lookupEither
  • Loading branch information
mandrean committed Mar 16, 2017
commit 22c929a5dfc8367b15eb2a36addef7f8ea30bb41
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@ instance ToFormUrlEncoded {{vendorExtensions.x-formName}} where
]{{/hasFormParams}}{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}

-- For the form data code generation.
lookupEither :: FromHttpApiData b => Text -> [(Text, Text)] -> Either Text b
lookupEither :: FromHttpApiData b => Text -> [(Text, Text)] -> Either String b
lookupEither key assocs =
case lookup key assocs of
Nothing -> Left $ "Could not find parameter " <> key <> " in form data"
Just value -> parseQueryParam value
Nothing -> Left $ "Could not find parameter " <> (T.unpack key) <> " in form data"
Just value ->
case parseQueryParam value of
Left result -> Left $ T.unpack result
Right result -> Right $ result

{{#apiInfo}}
-- | Servant type-level API, generated from the Swagger spec for {{title}}.
Expand Down