mirror of
https://github.com/scarf-sh/tie.git
synced 2024-11-30 01:33:37 +03:00
Fix generation of optional query parameters
This commit is contained in:
parent
193bbe2226
commit
c1c9b1fdb4
@ -331,12 +331,13 @@ codegenQueryParamGuard Param {name, required} continuation
|
||||
)
|
||||
)
|
||||
| otherwise =
|
||||
"case" <+> "fmap" <+> "(" <> "fmap" <+> "(" <> "Web.HttpApiData.parseUrlPiece" <+> "." <+> "Data.Text.Encoding.decodeUtf8" <> ")" <> ")" <+> "("
|
||||
"case" <+> "Control.Monad.join" <+> "(" <> "fmap" <+> "(" <> "fmap" <+> "(" <> "Web.HttpApiData.parseUrlPiece" <+> "." <+> "Data.Text.Encoding.decodeUtf8" <> ")" <> ")" <+> "("
|
||||
<> "Data.List.lookup" <+> "\""
|
||||
<> toParamName name
|
||||
<> "\"" <+> "("
|
||||
<> "Network.Wai.queryString" <+> "request"
|
||||
<> ")"
|
||||
<> ")"
|
||||
<> ")" <+> "of"
|
||||
<> PP.line
|
||||
<> PP.indent
|
||||
|
@ -77,7 +77,7 @@ application run api notFound request respond =
|
||||
Just (Left err) ->
|
||||
undefined
|
||||
Just (Right page) ->
|
||||
case fmap (fmap (Web.HttpApiData.parseUrlPiece . Data.Text.Encoding.decodeUtf8)) (Data.List.lookup "offset" (Network.Wai.queryString request)) of
|
||||
case Control.Monad.join (fmap (fmap (Web.HttpApiData.parseUrlPiece . Data.Text.Encoding.decodeUtf8)) (Data.List.lookup "offset" (Network.Wai.queryString request))) of
|
||||
Just (Left err) ->
|
||||
undefined
|
||||
_x ->
|
||||
@ -99,7 +99,7 @@ application run api notFound request respond =
|
||||
Just (Left err) ->
|
||||
undefined
|
||||
Just (Right page) ->
|
||||
case fmap (fmap (Web.HttpApiData.parseUrlPiece . Data.Text.Encoding.decodeUtf8)) (Data.List.lookup "offset" (Network.Wai.queryString request)) of
|
||||
case Control.Monad.join (fmap (fmap (Web.HttpApiData.parseUrlPiece . Data.Text.Encoding.decodeUtf8)) (Data.List.lookup "offset" (Network.Wai.queryString request))) of
|
||||
Just (Left err) ->
|
||||
undefined
|
||||
_x ->
|
||||
|
Loading…
Reference in New Issue
Block a user