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