mirror of
https://github.com/scarf-sh/tie.git
synced 2024-11-30 11:47:14 +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 =
|
| 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" <+> "\""
|
<> "Data.List.lookup" <+> "\""
|
||||||
<> toParamName name
|
<> toParamName name
|
||||||
<> "\"" <+> "("
|
<> "\"" <+> "("
|
||||||
<> "Network.Wai.queryString" <+> "request"
|
<> "Network.Wai.queryString" <+> "request"
|
||||||
<> ")"
|
<> ")"
|
||||||
|
<> ")"
|
||||||
<> ")" <+> "of"
|
<> ")" <+> "of"
|
||||||
<> PP.line
|
<> PP.line
|
||||||
<> PP.indent
|
<> PP.indent
|
||||||
|
@ -77,7 +77,7 @@ application run api notFound request respond =
|
|||||||
Just (Left err) ->
|
Just (Left err) ->
|
||||||
undefined
|
undefined
|
||||||
Just (Right page) ->
|
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) ->
|
Just (Left err) ->
|
||||||
undefined
|
undefined
|
||||||
_x ->
|
_x ->
|
||||||
@ -99,7 +99,7 @@ application run api notFound request respond =
|
|||||||
Just (Left err) ->
|
Just (Left err) ->
|
||||||
undefined
|
undefined
|
||||||
Just (Right page) ->
|
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) ->
|
Just (Left err) ->
|
||||||
undefined
|
undefined
|
||||||
_x ->
|
_x ->
|
||||||
|
Loading…
Reference in New Issue
Block a user