Fix ToSample issues
This commit is contained in:
parent
50b05860b7
commit
84211d4a0f
4 changed files with 11 additions and 13 deletions
|
@ -8,7 +8,6 @@
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
import Data.Proxy
|
import Data.Proxy
|
||||||
import Data.ByteString.Conversion
|
|
||||||
import Data.String.Conversions
|
import Data.String.Conversions
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import GHC.Generics
|
import GHC.Generics
|
||||||
|
|
|
@ -77,10 +77,10 @@
|
||||||
-- > "Get the greeting message selected language. Default is en."
|
-- > "Get the greeting message selected language. Default is en."
|
||||||
-- > Normal
|
-- > Normal
|
||||||
-- >
|
-- >
|
||||||
-- > instance ToSample Greet where
|
-- > instance ToSample Greet Greet where
|
||||||
-- > toSample = Just $ Greet "Hello, haskeller!"
|
-- > toSample _ = Just $ Greet "Hello, haskeller!"
|
||||||
-- >
|
-- >
|
||||||
-- > toSamples =
|
-- > toSamples _ =
|
||||||
-- > [ ("If you use ?capital=true", Greet "HELLO, HASKELLER")
|
-- > [ ("If you use ?capital=true", Greet "HELLO, HASKELLER")
|
||||||
-- > , ("If you use ?capital=false", Greet "Hello, haskeller")
|
-- > , ("If you use ?capital=false", Greet "Hello, haskeller")
|
||||||
-- > ]
|
-- > ]
|
||||||
|
|
|
@ -40,7 +40,6 @@ import GHC.Generics
|
||||||
import GHC.TypeLits
|
import GHC.TypeLits
|
||||||
import Servant.API
|
import Servant.API
|
||||||
import Servant.API.ContentTypes
|
import Servant.API.ContentTypes
|
||||||
import Servant.API.ResponseHeaders
|
|
||||||
import Servant.Utils.Links
|
import Servant.Utils.Links
|
||||||
|
|
||||||
import qualified Data.HashMap.Strict as HM
|
import qualified Data.HashMap.Strict as HM
|
||||||
|
@ -373,8 +372,8 @@ class HasDocs layout where
|
||||||
-- > instance FromJSON Greet
|
-- > instance FromJSON Greet
|
||||||
-- > instance ToJSON Greet
|
-- > instance ToJSON Greet
|
||||||
-- >
|
-- >
|
||||||
-- > instance ToSample Greet where
|
-- > instance ToSample Greet Greet where
|
||||||
-- > toSample = Just g
|
-- > toSample _ = Just g
|
||||||
-- >
|
-- >
|
||||||
-- > where g = Greet "Hello, haskeller!"
|
-- > where g = Greet "Hello, haskeller!"
|
||||||
--
|
--
|
||||||
|
|
|
@ -46,14 +46,14 @@ data Datatype1 = Datatype1 { dt1field1 :: String
|
||||||
|
|
||||||
instance ToJSON Datatype1
|
instance ToJSON Datatype1
|
||||||
|
|
||||||
instance ToSample Datatype1 where
|
instance ToSample Datatype1 Datatype1 where
|
||||||
toSample = Just $ Datatype1 "field 1" 13
|
toSample _ = Just $ Datatype1 "field 1" 13
|
||||||
|
|
||||||
instance ToSample String where
|
instance ToSample String String where
|
||||||
toSample = Just "a string"
|
toSample _ = Just "a string"
|
||||||
|
|
||||||
instance ToSample Int where
|
instance ToSample Int Int where
|
||||||
toSample = Just 17
|
toSample _ = Just 17
|
||||||
|
|
||||||
instance MimeRender PlainText Int where
|
instance MimeRender PlainText Int where
|
||||||
mimeRender _ = cs . show
|
mimeRender _ = cs . show
|
||||||
|
|
Loading…
Reference in a new issue