From bbc07d3f40cfa156cfe8cfb5db93f6da6c115748 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 28 Nov 2021 21:20:56 +0100 Subject: [PATCH] fix: Link to latest docs in pre-release openapi output Resolves #2018 --- src/PostgREST/Version.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PostgREST/Version.hs b/src/PostgREST/Version.hs index 4a9a37f48..d736c77b8 100644 --- a/src/PostgREST/Version.hs +++ b/src/PostgREST/Version.hs @@ -30,10 +30,12 @@ prettyVersion = -- | Version number used in docs. +-- Pre-release versions link to the latest docs -- Uses only the two first components of the version. Example: 'v1.1' docsVersion :: Text -docsVersion = - "v" <> (T.intercalate "." . map show . take 2 $ versionBranch version) +docsVersion + | isPreRelease = "latest" + | otherwise = "v" <> (T.intercalate "." . map show . take 2 $ versionBranch version) -- | Versions with four components (e.g., '1.1.1.1') are treated as pre-releases.