fix: FK pointing to VIEW instead of TABLE in OpenAPI output

This commit is contained in:
Laurence Isla
2023-01-20 09:37:15 -05:00
committed by GitHub
parent be6c30a0fb
commit 775c006806
3 changed files with 31 additions and 1 deletions
+17
View File
@@ -310,6 +310,23 @@ spec actualPgVersion = describe "OpenAPI" $ do
}
|]
describe "VIEW created for a TABLE with a O2M relationship" $ do
it "fk points to destination TABLE instead of the VIEW" $ do
r <- simpleBody <$> get "/"
let referralLink = r ^? key "definitions" . key "projects" . key "properties" . key "client_id"
liftIO $
referralLink `shouldBe` Just
[aesonQQ|
{
"format": "integer",
"type": "integer",
"description": "Note:\nThis is a Foreign Key to `clients.id`.<fk table='clients' column='id'/>"
}
|]
describe "PostgreSQL to Swagger Type Mapping" $ do
it "character varying to string" $ do