diff --git a/integration/test/Test/Swagger.hs b/integration/test/Test/Swagger.hs index 571bd1ab245..addde315e36 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] +existingVersions = Set.fromList [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] internalApis :: Set String internalApis = Set.fromList ["brig", "cannon", "cargohold", "cannon", "spar"] @@ -84,7 +84,7 @@ testSwaggerToc = do get path = rawBaseRequest OwnDomain Brig Unversioned path >>= submit "GET" html :: String - html = "

OpenAPI 3.0 docs for all Wire APIs

\n

This wire-server system provides OpenAPI 3.0 documentation of our HTTP REST API.

The openapi docs are correct by construction (compiled from the server code), and more or less complete.

Some endpoints are version-controlled. Show all supported versions. find out more.\n

Public (all available versions)

\nv0: \nswagger-ui; \nswagger.json\n
\nv1: \nswagger-ui; \nswagger.json\n
\nv2: \nswagger-ui; \nswagger.json\n
\nv3: \nswagger-ui; \nswagger.json\n
\nv4: \nswagger-ui; \nswagger.json\n
\nv5: \nswagger-ui; \nswagger.json\n
\nv6: \nswagger-ui; \nswagger.json\n
\nv7: \nswagger-ui; \nswagger.json\n
\n\n

Internal (not versioned)

\n

Openapi docs for internal endpoints are served per service. I.e. there's one for `brig`, one for `cannon`, etc.. This is because Openapi doesn't play well with multiple actions having the same combination of HTTP method and URL path.

\nbrig:
\nswagger-ui; \nswagger.json\n
\ngalley:
\nswagger-ui; \nswagger.json\n
\nspar:
\nswagger-ui; \nswagger.json\n
\ncargohold:
\nswagger-ui; \nswagger.json\n
\ngundeck:
\nswagger-ui; \nswagger.json\n
\ncannon:
\nswagger-ui; \nswagger.json\n
\nproxy:
\nswagger-ui; \nswagger.json\n
\n\n

Federated API (backend-to-backend)

\nbrig (v0):
swagger-ui; swagger.json
brig (v1):
swagger-ui; swagger.json
brig (v2):
swagger-ui; swagger.json

\ngalley (v0):
swagger-ui; swagger.json
galley (v1):
swagger-ui; swagger.json
galley (v2):
swagger-ui; swagger.json

\ncargohold (v0):
swagger-ui; swagger.json
cargohold (v1):
swagger-ui; swagger.json
cargohold (v2):
swagger-ui; swagger.json

\n\n\n" + html = "

OpenAPI 3.0 docs for all Wire APIs

\n

This wire-server system provides OpenAPI 3.0 documentation of our HTTP REST API.

The openapi docs are correct by construction (compiled from the server code), and more or less complete.

Some endpoints are version-controlled. Show all supported versions. find out more.\n

Public (all available versions)

\nv0: \nswagger-ui; \nswagger.json\n
\nv1: \nswagger-ui; \nswagger.json\n
\nv2: \nswagger-ui; \nswagger.json\n
\nv3: \nswagger-ui; \nswagger.json\n
\nv4: \nswagger-ui; \nswagger.json\n
\nv5: \nswagger-ui; \nswagger.json\n
\nv6: \nswagger-ui; \nswagger.json\n
\nv7: \nswagger-ui; \nswagger.json\n
\nv8: \nswagger-ui; \nswagger.json\n
\nv9: \nswagger-ui; \nswagger.json\n
\n\n

Internal (not versioned)

\n

Openapi docs for internal endpoints are served per service. I.e. there's one for `brig`, one for `cannon`, etc.. This is because Openapi doesn't play well with multiple actions having the same combination of HTTP method and URL path.

\nbrig:
\nswagger-ui; \nswagger.json\n
\ngalley:
\nswagger-ui; \nswagger.json\n
\nspar:
\nswagger-ui; \nswagger.json\n
\ncargohold:
\nswagger-ui; \nswagger.json\n
\ngundeck:
\nswagger-ui; \nswagger.json\n
\ncannon:
\nswagger-ui; \nswagger.json\n
\nproxy:
\nswagger-ui; \nswagger.json\n
\n\n

Federated API (backend-to-backend)

\nbrig (v0):
swagger-ui; swagger.json
brig (v1):
swagger-ui; swagger.json
brig (v2):
swagger-ui; swagger.json

\ngalley (v0):
swagger-ui; swagger.json
galley (v1):
swagger-ui; swagger.json
galley (v2):
swagger-ui; swagger.json

\ncargohold (v0):
swagger-ui; swagger.json
cargohold (v1):
swagger-ui; swagger.json
cargohold (v2):
swagger-ui; swagger.json

\n\n\n" data Swagger = SwaggerPublic | SwaggerInternal Service diff --git a/integration/test/Test/Version.hs b/integration/test/Test/Version.hs index df0a7ab731c..403ecd4f6a0 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 three development versions + -- + -- it is however theoretically possible to have a different number of + -- development versions + length dev `shouldMatchInt` 3 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 c6f55ef6d6d..1232f477e84 100644 --- a/libs/wire-api/src/Wire/API/Routes/Public/Cannon.hs +++ b/libs/wire-api/src/Wire/API/Routes/Public/Cannon.hs @@ -22,12 +22,14 @@ 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 = Named "await-notifications" ( Summary "Establish websocket connection" + :> 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/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