Hlint adjustment
This commit is contained in:
@@ -106,9 +106,7 @@ accessibleProcs =
|
|||||||
addName pd = (pdName pd, pd)
|
addName pd = (pdName pd, pd)
|
||||||
|
|
||||||
parseArgs :: Text -> [PgArg]
|
parseArgs :: Text -> [PgArg]
|
||||||
parseArgs = mapMaybe toks2arg
|
parseArgs = mapMaybe (toks2arg . split (==' ') . strip) . split (==',')
|
||||||
. map (split (==' ') . strip)
|
|
||||||
. split (==',')
|
|
||||||
|
|
||||||
toks2arg :: [Text] -> Maybe PgArg
|
toks2arg :: [Text] -> Maybe PgArg
|
||||||
toks2arg (x:y:"DEFAULT":_) = Just (PgArg x y False)
|
toks2arg (x:y:"DEFAULT":_) = Just (PgArg x y False)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ makeTableDef (t, cs, _) =
|
|||||||
let tn = tableName t in
|
let tn = tableName t in
|
||||||
(tn, (mempty :: Schema)
|
(tn, (mempty :: Schema)
|
||||||
& type_ .~ SwaggerObject
|
& type_ .~ SwaggerObject
|
||||||
& properties .~ (fromList $ map makeProperty cs))
|
& properties .~ fromList (map makeProperty cs))
|
||||||
|
|
||||||
makeProperty :: Column -> (Text, Referenced Schema)
|
makeProperty :: Column -> (Text, Referenced Schema)
|
||||||
makeProperty c = (colName c, Inline u)
|
makeProperty c = (colName c, Inline u)
|
||||||
@@ -58,8 +58,8 @@ makeProcDef pd = ("(rpc) " <> pdName pd, s)
|
|||||||
where
|
where
|
||||||
s = (mempty :: Schema)
|
s = (mempty :: Schema)
|
||||||
& type_ .~ SwaggerObject
|
& type_ .~ SwaggerObject
|
||||||
& properties .~ (fromList $ map makeProcProperty (pdArgs pd))
|
& properties .~ fromList (map makeProcProperty (pdArgs pd))
|
||||||
& required .~ (map pgaName $ filter pgaReq (pdArgs pd))
|
& required .~ map pgaName (filter pgaReq (pdArgs pd))
|
||||||
|
|
||||||
makeProcProperty :: PgArg -> (Text, Referenced Schema)
|
makeProcProperty :: PgArg -> (Text, Referenced Schema)
|
||||||
makeProcProperty (PgArg n t _) = (n, Inline s)
|
makeProcProperty (PgArg n t _) = (n, Inline s)
|
||||||
@@ -242,7 +242,7 @@ makeRootPathItem = ("/", p)
|
|||||||
|
|
||||||
makePathItems :: [ProcDescription] -> [(Table, [Column], [Text])] -> InsOrdHashMap FilePath PathItem
|
makePathItems :: [ProcDescription] -> [(Table, [Column], [Text])] -> InsOrdHashMap FilePath PathItem
|
||||||
makePathItems pds ti = fromList $ makeRootPathItem :
|
makePathItems pds ti = fromList $ makeRootPathItem :
|
||||||
(map makePathItem ti) ++ (map makeProcPathItem pds)
|
map makePathItem ti ++ map makeProcPathItem pds
|
||||||
|
|
||||||
escapeHostName :: Text -> Text
|
escapeHostName :: Text -> Text
|
||||||
escapeHostName "*" = "0.0.0.0"
|
escapeHostName "*" = "0.0.0.0"
|
||||||
@@ -261,7 +261,7 @@ postgrestSpec pds ti (s, h, p, b) = (mempty :: Swagger)
|
|||||||
& title .~ "PostgREST API"
|
& title .~ "PostgREST API"
|
||||||
& description ?~ "This is a dynamic API generated by PostgREST")
|
& description ?~ "This is a dynamic API generated by PostgREST")
|
||||||
& host .~ h'
|
& host .~ h'
|
||||||
& definitions .~ (fromList $ map makeTableDef ti <> map makeProcDef pds)
|
& definitions .~ fromList (map makeTableDef ti <> map makeProcDef pds)
|
||||||
& paths .~ makePathItems pds ti
|
& paths .~ makePathItems pds ti
|
||||||
where
|
where
|
||||||
s' = if s == "http" then Http else Https
|
s' = if s == "http" then Http else Https
|
||||||
|
|||||||
Reference in New Issue
Block a user