From 9a763f9b6c5e4d61a4c2ecbc9c0be4e708dfccf7 Mon Sep 17 00:00:00 2001 From: Salim B Date: Thu, 11 Jul 2024 14:36:49 +0200 Subject: [PATCH] fix: update OpenAPI `externalDocs` URL fixes https://github.com/PostgREST/postgrest/issues/3091 --- CHANGELOG.md | 1 + src/PostgREST/Response/OpenAPI.hs | 2 +- test/spec/Feature/OpenApi/OpenApiSpec.hs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d48a6f1f9c..9f1fa36863 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - #3644, Show number of timezones in schema cache load report - @wolfgangwalther - #3644, List correct enum options in OpenApi output when multiple types with same name are present - @wolfgangwalther - #3523, Fix schema cache loading retry without backoff - @steve-chavez + - #3091, Broken link in OpenAPI description `externalDocs` - @salim-b ### Changed diff --git a/src/PostgREST/Response/OpenAPI.hs b/src/PostgREST/Response/OpenAPI.hs index d93f34236a..fed13923e6 100644 --- a/src/PostgREST/Response/OpenAPI.hs +++ b/src/PostgREST/Response/OpenAPI.hs @@ -402,7 +402,7 @@ postgrestSpec (prettyVersion, docsVersion) rels pds ti (s, h, p, b) sd allowSecu & description ?~ fromMaybe "This is a dynamic API generated by PostgREST" dDesc) & externalDocs ?~ ((mempty :: ExternalDocs) & description ?~ "PostgREST Documentation" - & url .~ URL ("https://postgrest.org/en/" <> docsVersion <> "/api.html")) + & url .~ URL ("https://postgrest.org/en/" <> docsVersion <> "/references/api.html")) & host .~ h' & definitions .~ fromList (makeTableDef rels <$> ti) & parameters .~ fromList (makeParamDefs ti) diff --git a/test/spec/Feature/OpenApi/OpenApiSpec.hs b/test/spec/Feature/OpenApi/OpenApiSpec.hs index 215c4b5ac9..d17b7427fe 100644 --- a/test/spec/Feature/OpenApi/OpenApiSpec.hs +++ b/test/spec/Feature/OpenApi/OpenApiSpec.hs @@ -42,7 +42,7 @@ spec = describe "OpenAPI" $ do let docsUrl = r ^? key "externalDocs" . key "url" - liftIO $ docsUrl `shouldBe` Just (String ("https://postgrest.org/en/" <> docsVersion <> "/api.html")) + liftIO $ docsUrl `shouldBe` Just (String ("https://postgrest.org/en/" <> docsVersion <> "/references/api.html")) describe "schema" $ do