Skip to content

Commit

Permalink
remove swagger dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Sep 11, 2017
1 parent daa0765 commit 4e46e3e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
2 changes: 0 additions & 2 deletions currency-codes.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ library
build-depends: base >= 4 && < 5
, aeson >= 0.7.0.0
, bson >= 0.2.0
, lens >= 4.0.0
, random >= 1.0.0.0
, safe >= 0.2
, swagger2 >= 2.0.0
, text >= 1.0.0.0
exposed-modules: Data.Currency
13 changes: 0 additions & 13 deletions src/Data/Currency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ module Data.Currency where

import Prelude hiding (Ordering (..))

import Control.Lens ((&), (?~))
import Control.Monad ((>=>))
import Data.Aeson as Aeson
import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Bson (Val (..), (=:))
import qualified Data.Bson as Bson
import Data.Data (Data)
import Data.Proxy (Proxy (..))
import Data.Swagger (NamedSchema (..), ToSchema (..))
import qualified Data.Swagger as Swagger
import Data.Text (Text)
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
Expand All @@ -33,8 +29,6 @@ instance FromJSON Currency where parseJSON = Aeson.genericParseJSON Aes

instance ToJSON Currency where toJSON = Aeson.genericToJSON Aeson.defaultOptions

instance ToSchema Currency where declareNamedSchema = Swagger.genericDeclareNamedSchema Swagger.defaultSchemaOptions

instance Val Currency where
val Currency{..} = Bson.Doc
[ "alpha" =: alpha
Expand Down Expand Up @@ -251,13 +245,6 @@ instance ToJSON Alpha where toJSON = Aeson.genericToJSON Aeson.defaultOptio
instance Val Alpha where val = val . show
cast' = cast' >=> Safe.readMay

instance ToSchema Alpha where
declareNamedSchema _ = do
NamedSchema name schema <- declareNamedSchema (Proxy :: Proxy String)
return $ NamedSchema name $ schema
& Swagger.format ?~ "iso4217-alpha"
& Swagger.example ?~ Aeson.toJSON EUR

instance Random Alpha where
random g =
let (r, g') = randomR (fromEnum (minBound :: Alpha), fromEnum(maxBound :: Alpha)) g
Expand Down

0 comments on commit 4e46e3e

Please sign in to comment.