Correct openapi preparing statements by default
This commit is contained in:
committed by
Steve Chavez
parent
ba86b479f8
commit
15039553db
@@ -330,9 +330,9 @@ app dbStructure conf apiRequest =
|
|||||||
encodeApi ti sd procs = encodeOpenAPI (concat $ M.elems procs) (toTableInfo ti) uri' sd $ dbPrimaryKeys dbStructure
|
encodeApi ti sd procs = encodeOpenAPI (concat $ M.elems procs) (toTableInfo ti) uri' sd $ dbPrimaryKeys dbStructure
|
||||||
|
|
||||||
body <- encodeApi <$>
|
body <- encodeApi <$>
|
||||||
H.statement tSchema accessibleTables <*>
|
H.statement tSchema (accessibleTables prepared) <*>
|
||||||
H.statement tSchema schemaDescription <*>
|
H.statement tSchema (schemaDescription prepared) <*>
|
||||||
H.statement tSchema accessibleProcs
|
H.statement tSchema (accessibleProcs prepared)
|
||||||
return $ responseLBS status200 (catMaybes [Just $ toHeader CTOpenAPI, profileH]) (if headersOnly then mempty else toS body)
|
return $ responseLBS status200 (catMaybes [Just $ toHeader CTOpenAPI, profileH]) (if headersOnly then mempty else toS body)
|
||||||
|
|
||||||
_ -> return notFound
|
_ -> return notFound
|
||||||
|
|||||||
@@ -172,8 +172,8 @@ allProcs = H.Statement (toS sql) (arrayParam HE.text) decodeProcs
|
|||||||
where
|
where
|
||||||
sql = procsSqlQuery <> " WHERE pn.nspname = ANY($1)"
|
sql = procsSqlQuery <> " WHERE pn.nspname = ANY($1)"
|
||||||
|
|
||||||
accessibleProcs :: H.Statement Schema ProcsMap
|
accessibleProcs :: Bool -> H.Statement Schema ProcsMap
|
||||||
accessibleProcs = H.Statement (toS sql) (param HE.text) decodeProcs True
|
accessibleProcs = H.Statement (toS sql) (param HE.text) decodeProcs
|
||||||
where
|
where
|
||||||
sql = procsSqlQuery <> " WHERE pn.nspname = $1 AND has_function_privilege(p.oid, 'execute')"
|
sql = procsSqlQuery <> " WHERE pn.nspname = $1 AND has_function_privilege(p.oid, 'execute')"
|
||||||
|
|
||||||
@@ -244,9 +244,9 @@ procsSqlQuery = [q|
|
|||||||
LEFT JOIN pg_catalog.pg_description as d ON d.objoid = p.oid
|
LEFT JOIN pg_catalog.pg_description as d ON d.objoid = p.oid
|
||||||
|]
|
|]
|
||||||
|
|
||||||
schemaDescription :: H.Statement Schema (Maybe Text)
|
schemaDescription :: Bool -> H.Statement Schema (Maybe Text)
|
||||||
schemaDescription =
|
schemaDescription =
|
||||||
H.Statement sql (param HE.text) (join <$> HD.rowMaybe (nullableColumn HD.text)) True
|
H.Statement sql (param HE.text) (join <$> HD.rowMaybe (nullableColumn HD.text))
|
||||||
where
|
where
|
||||||
sql = [q|
|
sql = [q|
|
||||||
select
|
select
|
||||||
@@ -257,9 +257,9 @@ schemaDescription =
|
|||||||
where
|
where
|
||||||
n.nspname = $1 |]
|
n.nspname = $1 |]
|
||||||
|
|
||||||
accessibleTables :: H.Statement Schema [Table]
|
accessibleTables :: Bool -> H.Statement Schema [Table]
|
||||||
accessibleTables =
|
accessibleTables =
|
||||||
H.Statement sql (param HE.text) decodeTables True
|
H.Statement sql (param HE.text) decodeTables
|
||||||
where
|
where
|
||||||
sql = [q|
|
sql = [q|
|
||||||
select
|
select
|
||||||
|
|||||||
Reference in New Issue
Block a user