servant-csharp 0.0.8.0 → 0.0.8.1
raw patch · 3 files changed
+35/−4 lines, 3 filesdep −haskell-src-extsPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependencies removed: haskell-src-exts
API changes (from Hackage documentation)
+ CS.Common: instance Servant.Foreign.Internal.HasForeignType CS.Common.CSharp Data.Text.Internal.Text (GHC.Base.Maybe GHC.Types.Double)
+ CS.Common: instance Servant.Foreign.Internal.HasForeignType CS.Common.CSharp Data.Text.Internal.Text (GHC.Base.Maybe GHC.Types.Float)
+ CS.Common: instance Servant.Foreign.Internal.HasForeignType CS.Common.CSharp Data.Text.Internal.Text (GHC.Base.Maybe GHC.Word.Word16)
+ CS.Common: instance Servant.Foreign.Internal.HasForeignType CS.Common.CSharp Data.Text.Internal.Text (GHC.Base.Maybe GHC.Word.Word32)
+ CS.Common: instance Servant.Foreign.Internal.HasForeignType CS.Common.CSharp Data.Text.Internal.Text (GHC.Base.Maybe GHC.Word.Word64)
+ CS.Common: instance Servant.Foreign.Internal.HasForeignType CS.Common.CSharp Data.Text.Internal.Text (GHC.Base.Maybe GHC.Word.Word8)
+ CS.Common: instance Servant.Foreign.Internal.HasForeignType CS.Common.CSharp Data.Text.Internal.Text GHC.Types.Double
+ CS.Common: instance Servant.Foreign.Internal.HasForeignType CS.Common.CSharp Data.Text.Internal.Text GHC.Types.Float
+ CS.Common: instance Servant.Foreign.Internal.HasForeignType CS.Common.CSharp Data.Text.Internal.Text GHC.Word.Word16
+ CS.Common: instance Servant.Foreign.Internal.HasForeignType CS.Common.CSharp Data.Text.Internal.Text GHC.Word.Word32
+ CS.Common: instance Servant.Foreign.Internal.HasForeignType CS.Common.CSharp Data.Text.Internal.Text GHC.Word.Word64
+ CS.Common: instance Servant.Foreign.Internal.HasForeignType CS.Common.CSharp Data.Text.Internal.Text GHC.Word.Word8
+ CS.Common: instance Servant.Foreign.Internal.HasForeignType CS.Common.CSharp Data.Text.Internal.Text a => Servant.Foreign.Internal.HasForeignType CS.Common.CSharp Data.Text.Internal.Text (GHC.Base.Maybe [a])
Files
- servant-csharp.cabal +1/−2
- src/CS/Common.hs +30/−0
- src/CS/JsonDotNet.hs +4/−2
servant-csharp.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: servant-csharp-version: 0.0.8.0+version: 0.0.8.1 synopsis: Generate servant client library for C# description: Generate servant client library for C# homepage: https://github.com/cutsea110/servant-csharp.git@@ -37,7 +37,6 @@ , bytestring >=0.10 && <0.11 , directory >=1.2 && <1.3 , filepath >=1.4 && <1.5- , haskell-src-exts >=1.17 && <1.18 , heredocs >=0.1 && <0.2 , http-types >=0.9 && <0.10 , lens >=4.13 && <4.14
src/CS/Common.hs view
@@ -11,6 +11,7 @@ import Data.Time (UTCTime) import Data.Time.Calendar (Day) import Data.Typeable+import Data.Word import Servant.Foreign data CSharp@@ -18,6 +19,9 @@ instance HasForeignType CSharp Text a => HasForeignType CSharp Text [a] where typeFor lang ftype (Proxy :: Proxy [t]) = "List<" <> typeFor lang ftype (Proxy :: Proxy t) <> ">" +instance HasForeignType CSharp Text a => HasForeignType CSharp Text (Maybe [a]) where+ typeFor lang ftype (Proxy :: Proxy (Maybe [t])) = typeFor lang ftype (Proxy :: Proxy [t])+ instance HasForeignType CSharp Text a => HasForeignType CSharp Text (Maybe a) where typeFor lang ftype (Proxy :: Proxy (Maybe t)) = "Nullable<" <> typeFor lang ftype (Proxy :: Proxy t) <> ">" @@ -28,6 +32,32 @@ typeFor _ _ _ = "int" instance {-# OVERLAPPING #-} HasForeignType CSharp Text (Maybe Int) where typeFor _ _ _ = "int?"+instance {-# OVERLAPPING #-} HasForeignType CSharp Text Word8 where+ typeFor _ _ _ = "int"+instance {-# OVERLAPPING #-} HasForeignType CSharp Text (Maybe Word8) where+ typeFor _ _ _ = "int?"+instance {-# OVERLAPPING #-} HasForeignType CSharp Text Word16 where+ typeFor _ _ _ = "int"+instance {-# OVERLAPPING #-} HasForeignType CSharp Text (Maybe Word16) where+ typeFor _ _ _ = "int?"+instance {-# OVERLAPPING #-} HasForeignType CSharp Text Word32 where+ typeFor _ _ _ = "int"+instance {-# OVERLAPPING #-} HasForeignType CSharp Text (Maybe Word32) where+ typeFor _ _ _ = "int?"+instance {-# OVERLAPPING #-} HasForeignType CSharp Text Word64 where+ typeFor _ _ _ = "int"+instance {-# OVERLAPPING #-} HasForeignType CSharp Text (Maybe Word64) where+ typeFor _ _ _ = "int?"++instance {-# OVERLAPPING #-} HasForeignType CSharp Text Float where+ typeFor _ _ _ = "float"+instance {-# OVERLAPPING #-} HasForeignType CSharp Text (Maybe Float) where+ typeFor _ _ _ = "float?"++instance {-# OVERLAPPING #-} HasForeignType CSharp Text Double where+ typeFor _ _ _ = "double"+instance {-# OVERLAPPING #-} HasForeignType CSharp Text (Maybe Double) where+ typeFor _ _ _ = "double?" instance {-# OVERLAPPING #-} HasForeignType CSharp Text Text where typeFor _ _ _ = "string"
src/CS/JsonDotNet.hs view
@@ -36,7 +36,8 @@ import Data.Swagger hiding (namespace) import Data.Text as T (Text, unpack) import Data.Time.Clock (UTCTime(..), getCurrentTime)-import Data.Time.Calendar (toGregorian)+import Data.Time.Calendar (Day(..), toGregorian)+import Data.Word import System.Directory (createDirectoryIfMissing) import System.FilePath ((</>),(<.>)) import Data.UUID.Types (toString, UUID)@@ -45,7 +46,7 @@ import Servant.Swagger import Text.Heredoc -import CS.Common (CSharp, getEndpoints)+import CS.Common import CS.JsonDotNet.Internal import CS.JsonDotNet.Base @@ -76,6 +77,7 @@ generateCsForAPI conf api = do let outDir = "gen" </> namespace conf swagger = toSwagger api+ createDirectoryIfMissing True $ outDir </> "Properties" writeFile (outDir </> "AssemblyInfo.cs") =<< assemblyInfoCs conf writeFile (outDir </> namespace conf <.> "csproj") =<< projectCsproj conf writeFile (outDir </> classCsName conf)