Skip to content

Commit

Permalink
Correct openapi ignore-privs table comments
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-chavez committed Jul 6, 2021
1 parent 67c2ed7 commit 0961a58
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 66 deletions.
3 changes: 2 additions & 1 deletion src/PostgREST/DbStructure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ allTables =
SELECT
n.nspname AS table_schema,
c.relname AS table_name,
NULL AS table_description,
d.description AS table_description,
(
c.relkind = 'r'
OR (
Expand Down Expand Up @@ -521,6 +521,7 @@ allTables =
) AS deletable
FROM pg_class c
JOIN pg_namespace n ON n.oid = c.relnamespace
LEFT JOIN pg_catalog.pg_description as d on d.objoid = c.oid and d.objsubid = 0
WHERE c.relkind IN ('v','r','m','f')
AND n.nspname NOT IN ('pg_catalog', 'information_schema')
ORDER BY table_schema, table_name |]
Expand Down
65 changes: 0 additions & 65 deletions test/Feature/IgnoreAclOpenApiSpec.hs

This file was deleted.

11 changes: 11 additions & 0 deletions test/Feature/IgnorePrivOpenApiSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ spec = describe "OpenAPI Ignore Privileges" $ do

liftIO $ tableKey2 `shouldNotBe` Nothing

it "includes comments on tables" $ do
r <- simpleBody <$> get "/"

let grandChildGet s = key "paths" . key "/grandchild_entities" . key "get" . key s
grandChildGetSummary = r ^? grandChildGet "summary"
grandChildGetDescription = r ^? grandChildGet "description"

liftIO $ do
grandChildGetSummary `shouldBe` Just "grandchild_entities summary"
grandChildGetDescription `shouldBe` Just "grandchild_entities description\nthat spans\nmultiple lines"

describe "RPC" $ do

it "includes privileged function even if user does not have permission" $ do
Expand Down

0 comments on commit 0961a58

Please sign in to comment.