-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
--------- Co-authored-by: Igor Ranieri Elland <[email protected]> Co-authored-by: Igor Ranieri <[email protected]>
- Loading branch information
1 parent
85cb5a9
commit 2e3a6ec
Showing
191 changed files
with
890 additions
and
579 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Updating the route documentation from Swagger 2 to OpenAPI 3. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Updating the route documentation library from swagger2 to openapi3. | ||
|
||
This also introduced a breaking change in how we track what federation calls each route makes. | ||
The openapi3 library doesn't support extension fields, and as such tags are being used instead in a similar way. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{-# LANGUAGE RankNTypes #-} | ||
|
||
-- This file is part of the Wire Server implementation. | ||
-- | ||
-- Copyright (C) 2022 Wire Swiss GmbH <[email protected]> | ||
|
@@ -22,10 +24,10 @@ module Deriving.Swagger where | |
import Data.Char qualified as Char | ||
import Data.Kind (Constraint) | ||
import Data.List.Extra (stripSuffix) | ||
import Data.OpenApi.Internal.Schema (GToSchema) | ||
import Data.OpenApi.Internal.TypeShape | ||
import Data.OpenApi.Schema | ||
import Data.Proxy (Proxy (..)) | ||
import Data.Swagger (SchemaOptions, ToSchema (..), constructorTagModifier, defaultSchemaOptions, fieldLabelModifier, genericDeclareNamedSchema) | ||
import Data.Swagger.Internal.Schema (GToSchema) | ||
import Data.Swagger.Internal.TypeShape (TypeHasSimpleShape) | ||
import GHC.Generics (Generic (Rep)) | ||
import GHC.TypeLits (ErrorMessage (Text), KnownSymbol, Symbol, TypeError, symbolVal) | ||
import Imports | ||
|
@@ -81,6 +83,7 @@ import Imports | |
-- | A newtype wrapper which gives ToSchema instances with modified options. | ||
-- 't' has to have an instance of the 'SwaggerOptions' class. | ||
newtype CustomSwagger t a = CustomSwagger {unCustomSwagger :: a} | ||
deriving (Generic, Typeable) | ||
|
||
class SwaggerOptions xs where | ||
swaggerOptions :: SchemaOptions | ||
|
@@ -94,14 +97,7 @@ instance (StringModifier f, SwaggerOptions xs) => SwaggerOptions (FieldLabelModi | |
instance (StringModifier f, SwaggerOptions xs) => SwaggerOptions (ConstructorTagModifier f ': xs) where | ||
swaggerOptions = (swaggerOptions @xs) {constructorTagModifier = getStringModifier @f} | ||
|
||
instance | ||
( SwaggerOptions t, | ||
Generic a, | ||
GToSchema (Rep a), | ||
TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted" | ||
) => | ||
ToSchema (CustomSwagger t a) | ||
where | ||
instance (SwaggerOptions t, Generic a, Typeable a, GToSchema (Rep a), Typeable (CustomSwagger t a), TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") => ToSchema (CustomSwagger t a) where | ||
declareNamedSchema _ = genericDeclareNamedSchema (swaggerOptions @t) (Proxy @a) | ||
|
||
-- ** Specify __what__ to modify | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.