packages feed

servant-swagger 0.0.0.0 → 0.0.0.1

raw patch · 3 files changed

+42/−9 lines, 3 files

Files

servant-swagger.cabal view
@@ -1,5 +1,5 @@ name:                servant-swagger-version:             0.0.0.0+version:             0.0.0.1 synopsis:            Swagger description:         Swagger license:             BSD3@@ -12,6 +12,9 @@ cabal-version:       >=1.10 description:         This is an experimental release, this API is subject to change at any moment. +source-repository head+  type:     git+  location: git://github.com/dmjio/servant-swagger.git  library   ghc-options:         -Wall
src/Servant/Swagger.hs view
@@ -69,6 +69,12 @@   , swagRouteOperationId   , defSwaggerInfo   , createSwaggerJson+  , swaggerInfoTitle+  , swaggerVersion+  , swaggerAPIDescription+  , license+  , contact+  , termsOfService   ) where  import Servant.Swagger.Internal
src/Servant/Swagger/Internal.hs view
@@ -138,15 +138,15 @@  -- | Contact name of `Contact` object newtype ContactName = ContactName Text-  deriving (Show, Eq, ToJSON, FromJSON, Ord)+  deriving (Show, Eq, ToJSON, FromJSON, Ord, Monoid)  -- | Contact URL of `Contact` object newtype ContactURL = ContactURL Text-  deriving (Show, Eq, ToJSON, FromJSON, Ord)+  deriving (Show, Eq, ToJSON, FromJSON, Ord, Monoid)  -- | Contact Email of `Contact` object newtype ContactEmail = ContactEmail Text-  deriving (Show, Eq, ToJSON, FromJSON, Ord)+  deriving (Show, Eq, ToJSON, FromJSON, Ord, Monoid)  -- | Contact Object data Contact = Contact {@@ -155,6 +155,11 @@   , _contactEmail :: ContactEmail   } deriving (Show, Eq, Ord) +instance Monoid Contact where+  mempty = Contact mempty mempty mempty+  (Contact a1 b1 c1) `mappend` (Contact a2 b2 c2) =+     Contact (a1 <> a2) (b1 <> b2) (c1 <> c2)+ -- | Contact Object instance ToJSON Contact where   toJSON Contact{..} =@@ -166,11 +171,11 @@  -- | Description of API newtype APIDescription = APIDescription { _unApiDesc :: Text }-   deriving (Show, Eq, ToJSON)+   deriving (Show, Eq, ToJSON, Monoid)  -- | Terms of Service of API located in `Info` newtype TermsOfService = TermsOfService Text-   deriving (Show, Eq, ToJSON)+   deriving (Show, Eq, ToJSON, Monoid)  -- | A Swagger metadata for a Servant header data SwaggerHeader = SwaggerHeader {@@ -277,11 +282,20 @@   , _termsOfService        :: Maybe TermsOfService   } deriving (Show, Eq) +instance Monoid Info where+  mempty = Info mempty mempty mempty mempty mempty mempty +  (Info a1 b1 c1 d1 e1 f1) `mappend` (Info a2 b2 c2 d2 e2 f2)+    = Info (a1 <> a2) (b1 <> b2) (c1 <> c2) (d1 <> d2) (e1 <> e2) (f1 <> f2)+ data APILicense = APILicense {      _licenseName :: Text   ,  _licenseUrl  :: Maybe Text   } deriving (Show, Eq) +instance Monoid APILicense where+  mempty = APILicense mempty mempty+  (APILicense a1 b1) `mappend` (APILicense a2 b2) = APILicense (a1 <> a2) (b1 <> b2)+ data SwaggerOperation = SwaggerOperation {      _paths :: HM.HashMap Verb Operation   } deriving Show@@ -310,9 +324,19 @@   } deriving Show  instance Monoid Operation where-  mempty = Operation mempty mempty mempty mempty mempty mempty mempty mempty Nothing+  mempty = Operation mempty mempty mempty mempty mempty mempty mempty mempty mempty+  (Operation a1 b1 c1 d1 e1 f1 g1 h1 i1) `mappend` +    (Operation a2 b2 c2 d2 e2 f2 g2 h2 i2) =+       Operation (a1 <> a2) (b1 <> b2) (c1 <> c2) (d1 <> d2) (e1 <> e2) (f1 <> f2) (g1 <> g2)+          (h1 <> h2) (i1 <> i2)   newtype Deprecated = Deprecated Bool deriving (Show, Eq, ToJSON)++instance Monoid Deprecated where+  mempty = Deprecated False+  (Deprecated False) `mappend` (Deprecated False) = Deprecated False+  _ `mappend` _ = Deprecated True+ newtype OperationId = OperationId Text deriving (Show, Eq, ToJSON, Monoid) newtype PathDescription = PathDescription Text deriving (Show, Eq, ToJSON, Monoid) @@ -369,8 +393,8 @@      _itemsType :: SwaggerParamType   } deriving Show -newtype APIVersion = APIVersion Text deriving (Show, Eq, ToJSON)-newtype APITitle = APITitle Text deriving (Show, Eq, ToJSON)+newtype APIVersion = APIVersion Text deriving (Show, Eq, ToJSON, Monoid)+newtype APITitle = APITitle Text deriving (Show, Eq, ToJSON, Monoid) newtype PathName = PathName { unPathName :: Text }   deriving (Show, Eq, Hashable, Monoid)