diff --git a/changelog.d/1-api-changes/WPB-10324 b/changelog.d/1-api-changes/WPB-10324 new file mode 100644 index 00000000000..4ea4ee2b2a7 --- /dev/null +++ b/changelog.d/1-api-changes/WPB-10324 @@ -0,0 +1 @@ +Drop legacy notification endpoints from client API at version 9 diff --git a/integration/test/Test/Swagger.hs b/integration/test/Test/Swagger.hs index a84fc7b5419..8bd8bbbc14e 100644 --- a/integration/test/Test/Swagger.hs +++ b/integration/test/Test/Swagger.hs @@ -13,7 +13,7 @@ import Testlib.Prelude import UnliftIO.Temporary existingVersions :: Set Int -existingVersions = Set.fromList [0, 1, 2, 3, 4, 5, 6, 7, 8] +existingVersions = Set.fromList [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] internalApis :: Set String internalApis = Set.fromList ["brig", "cannon", "cargohold", "cannon", "spar"] diff --git a/integration/test/Test/Version.hs b/integration/test/Test/Version.hs index df0a7ab731c..08136e574b4 100644 --- a/integration/test/Test/Version.hs +++ b/integration/test/Test/Version.hs @@ -15,7 +15,9 @@ instance TestCases Versioned' where MkTestCase "[version=versioned]" (Versioned' Versioned), MkTestCase "[version=v1]" (Versioned' (ExplicitVersion 1)), MkTestCase "[version=v3]" (Versioned' (ExplicitVersion 3)), - MkTestCase "[version=v6]" (Versioned' (ExplicitVersion 6)) + MkTestCase "[version=v6]" (Versioned' (ExplicitVersion 6)), + MkTestCase "[version=v7]" (Versioned' (ExplicitVersion 7)), + MkTestCase "[version=v8]" (Versioned' (ExplicitVersion 8)) ] -- | Used to test endpoints that have changed after version 5 @@ -43,9 +45,11 @@ testVersion (Versioned' v) = withModifiedBackend domain <- resp.json %. "domain" & asString federation <- resp.json %. "federation" & asBool - -- currently there is only one development version - -- it is however theoretically possible to have multiple development versions - length dev `shouldMatchInt` 1 + -- currently there are two development versions + -- + -- it is however possible to have a different number of development + -- versions + length dev `shouldMatchInt` 2 domain `shouldMatch` dom federation `shouldMatch` True @@ -77,6 +81,8 @@ testVersionDisabled = withModifiedBackend void $ getSelfWithVersion (ExplicitVersion 4) user >>= getJSON 200 void $ getSelfWithVersion (ExplicitVersion 5) user >>= getJSON 200 void $ getSelfWithVersion (ExplicitVersion 6) user >>= getJSON 200 + void $ getSelfWithVersion (ExplicitVersion 7) user >>= getJSON 200 + void $ getSelfWithVersion (ExplicitVersion 8) user >>= getJSON 200 void $ getSelfWithVersion Unversioned user >>= getJSON 200 testVersionDisabledNotAdvertised :: App () diff --git a/libs/wire-api/src/Wire/API/Routes/Public/Cannon.hs b/libs/wire-api/src/Wire/API/Routes/Public/Cannon.hs index 03742511080..e2d6423c2f6 100644 --- a/libs/wire-api/src/Wire/API/Routes/Public/Cannon.hs +++ b/libs/wire-api/src/Wire/API/Routes/Public/Cannon.hs @@ -22,6 +22,7 @@ import Servant import Wire.API.Routes.API import Wire.API.Routes.Named import Wire.API.Routes.Public (ZConn, ZUser) +import Wire.API.Routes.Version import Wire.API.Routes.WebSocket type CannonAPI = @@ -29,6 +30,7 @@ type CannonAPI = "await-notifications" ( Summary "Establish websocket connection" -- Description "This is the legacy variant of \"consume-events\"" + :> Until 'V9 :> "await" :> ZUser :> ZConn diff --git a/libs/wire-api/src/Wire/API/Routes/Public/Gundeck.hs b/libs/wire-api/src/Wire/API/Routes/Public/Gundeck.hs index b2d0d329dae..797ffeacb36 100644 --- a/libs/wire-api/src/Wire/API/Routes/Public/Gundeck.hs +++ b/libs/wire-api/src/Wire/API/Routes/Public/Gundeck.hs @@ -68,6 +68,7 @@ type NotificationAPI = Named "get-notification-by-id" ( Summary "Fetch a notification by ID" + :> Until 'V9 :> ZUser :> "notifications" :> Capture' '[Description "Notification ID"] "id" NotificationId @@ -83,6 +84,7 @@ type NotificationAPI = :<|> Named "get-last-notification" ( Summary "Fetch the last notification" + :> Until 'V9 :> ZUser :> "notifications" :> "last" @@ -116,6 +118,7 @@ type NotificationAPI = "get-notifications" ( Summary "Fetch notifications" :> From 'V3 + :> Until 'V9 :> ZUser :> "notifications" :> QueryParam' [Optional, Strict, Description "Only return notifications more recent than this"] "since" NotificationId diff --git a/libs/wire-api/src/Wire/API/Routes/Version.hs b/libs/wire-api/src/Wire/API/Routes/Version.hs index 4ecd8475fbc..161e7e34c5c 100644 --- a/libs/wire-api/src/Wire/API/Routes/Version.hs +++ b/libs/wire-api/src/Wire/API/Routes/Version.hs @@ -80,7 +80,7 @@ import Wire.Arbitrary (Arbitrary, GenericUniform (GenericUniform)) -- and 'developmentVersions' stay in sync; everything else here should keep working without -- change. See also documentation in the *docs* directory. -- https://docs.wire.com/developer/developer/api-versioning.html#version-bump-checklist -data Version = V0 | V1 | V2 | V3 | V4 | V5 | V6 | V7 | V8 +data Version = V0 | V1 | V2 | V3 | V4 | V5 | V6 | V7 | V8 | V9 deriving stock (Eq, Ord, Bounded, Enum, Show, Generic) deriving (FromJSON, ToJSON) via (Schema Version) deriving (Arbitrary) via (GenericUniform Version) @@ -101,6 +101,7 @@ versionInt V5 = 5 versionInt V6 = 6 versionInt V7 = 7 versionInt V8 = 8 +versionInt V9 = 9 supportedVersions :: [Version] supportedVersions = [minBound .. maxBound] @@ -213,6 +214,7 @@ isDevelopmentVersion V5 = False isDevelopmentVersion V6 = False isDevelopmentVersion V7 = False isDevelopmentVersion V8 = True +isDevelopmentVersion V9 = True developmentVersions :: [Version] developmentVersions = filter isDevelopmentVersion supportedVersions diff --git a/services/brig/src/Brig/API/Public.hs b/services/brig/src/Brig/API/Public.hs index 1ebeea8615f..8ec848200b3 100644 --- a/services/brig/src/Brig/API/Public.hs +++ b/services/brig/src/Brig/API/Public.hs @@ -209,6 +209,22 @@ internalEndpointsSwaggerDocsAPIs = -- -- Dual to `internalEndpointsSwaggerDocsAPI`. versionedSwaggerDocsAPI :: Servant.Server VersionedSwaggerDocsAPI +versionedSwaggerDocsAPI (Just (VersionNumber V9)) = + swaggerSchemaUIServer $ + ( serviceSwagger @VersionAPITag @'V9 + <> serviceSwagger @BrigAPITag @'V9 + <> serviceSwagger @GalleyAPITag @'V9 + <> serviceSwagger @SparAPITag @'V9 + <> serviceSwagger @CargoholdAPITag @'V9 + <> serviceSwagger @CannonAPITag @'V9 + <> serviceSwagger @GundeckAPITag @'V9 + <> serviceSwagger @ProxyAPITag @'V9 + <> serviceSwagger @OAuthAPITag @'V9 + ) + & S.info . S.title .~ "Wire-Server API" + & S.info . S.description ?~ $(embedText =<< makeRelativeToProject "docs/swagger.md") + & S.servers .~ [S.Server ("/" <> toUrlPiece V9) Nothing mempty] + & cleanupSwagger versionedSwaggerDocsAPI (Just (VersionNumber V8)) = swaggerSchemaUIServer $ ( serviceSwagger @VersionAPITag @'V8 diff --git a/services/brig/test/integration/API/User/Auth.hs b/services/brig/test/integration/API/User/Auth.hs index a93fa99317b..5098eb6ce27 100644 --- a/services/brig/test/integration/API/User/Auth.hs +++ b/services/brig/test/integration/API/User/Auth.hs @@ -245,7 +245,7 @@ testNginz b n = do post (unversioned . n . path "/access" . cookie c . header "Authorization" ("Bearer " <> toByteString' t)) toByteString' t)) !!! const 200 === statusCode + get (apiVersion "v8" . n . path "/notifications" . header "Authorization" ("Bearer " <> toByteString' t)) !!! const 200 === statusCode testNginzLegalHold :: Brig -> Galley -> Nginz -> Http () testNginzLegalHold b g n = do @@ -282,7 +282,7 @@ testNginzLegalHold b g n = do get (n . path "/clients" . header "Authorization" ("Bearer " <> toByteString' t)) !!! const 403 === statusCode get (n . path "/self" . header "Authorization" ("Bearer " <> toByteString' t)) !!! const 403 === statusCode -- ensure legal hold tokens can fetch notifications - get (n . path "/notifications" . header "Authorization" ("Bearer " <> toByteString' t)) !!! const 200 === statusCode + get (apiVersion "v8" . n . path "/notifications" . header "Authorization" ("Bearer " <> toByteString' t)) !!! const 200 === statusCode get (apiVersion "v1" . n . paths ["legalhold", "conversations", toByteString' (qUnqualified qconv)] . header "Authorization" ("Bearer " <> toByteString' t)) !!! const 200 === statusCode