minor fix to template location for haskell

This commit is contained in:
wing328 2016-02-02 22:37:01 +08:00
parent f77a8672fc
commit 743a533c65
5 changed files with 16 additions and 11 deletions

View File

@ -74,7 +74,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
* Template Location. This is the location which templates will be read from. The generator * Template Location. This is the location which templates will be read from. The generator
* will use the resource stream to attempt to read the templates. * will use the resource stream to attempt to read the templates.
*/ */
embeddedTemplateDir = templateDir = "haskell"; embeddedTemplateDir = templateDir = "haskell-servant";
/** /**
* Api Package. Optional, if needed, this can be used in templates * Api Package. Optional, if needed, this can be used in templates
@ -342,4 +342,4 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
return op; return op;
} }
} }

View File

@ -21,8 +21,8 @@ import Model.Pet
import Model.Tag import Model.Tag
import Model.Order import Model.Order
import Api.UserApi import Api.UserApi
import Api.StoreApi
import Api.PetApi import Api.PetApi
import Api.StoreApi
-- userClient :: IO () -- userClient :: IO ()
-- userClient = do -- userClient = do

View File

@ -2,7 +2,7 @@ name: haskell-servant-codegen
version: 0.1.0.0 version: 0.1.0.0
synopsis: Swagger-codegen example for Haskell servant synopsis: Swagger-codegen example for Haskell servant
description: Please see README.md description: Please see README.md
homepage: http://github.com/algas/haskell-servant-codegen#readme homepage: https://github.com/swagger-api/swagger-codegen#readme
license: Apache-2.0 license: Apache-2.0
license-file: LICENSE license-file: LICENSE
author: Masahiro Yamauchi author: Masahiro Yamauchi
@ -22,8 +22,8 @@ library
, Model.Tag , Model.Tag
, Model.Order , Model.Order
, Api.UserApi , Api.UserApi
, Api.StoreApi
, Api.PetApi , Api.PetApi
, Api.StoreApi
, Apis , Apis
ghc-options: -Wall ghc-options: -Wall
build-depends: base build-depends: base
@ -62,7 +62,3 @@ executable server
, servant-mock , servant-mock
, haskell-servant-codegen , haskell-servant-codegen
default-language: Haskell2010 default-language: Haskell2010
source-repository head
type: git
location: https://github.com/algas/haskell-servant-codegen

View File

@ -14,6 +14,8 @@ module Api.PetApi (
, updatePetWithForm , updatePetWithForm
, deletePet , deletePet
, uploadFile , uploadFile
, getPetByIdWithByteArray
, addPetUsingByteArray
, proxyPetApi , proxyPetApi
, PetApi , PetApi
) where ) where
@ -30,6 +32,7 @@ import qualified Data.Text as T
import Utils import Utils
import Test.QuickCheck import Test.QuickCheck
import Model.Pet import Model.Pet
import Model.Binary
@ -62,6 +65,8 @@ instance Arbitrary FormadditionalMetadatafile where
arbitrary = FormadditionalMetadatafile <$> arbitrary <*> arbitrary arbitrary = FormadditionalMetadatafile <$> arbitrary <*> arbitrary
type PetApi = "pet" :> ReqBody '[JSON] Pet :> Put '[JSON] () -- updatePet type PetApi = "pet" :> ReqBody '[JSON] Pet :> Put '[JSON] () -- updatePet
:<|> "pet" :> ReqBody '[JSON] Pet :> Post '[JSON] () -- addPet :<|> "pet" :> ReqBody '[JSON] Pet :> Post '[JSON] () -- addPet
:<|> "pet" :> "findByStatus" :> QueryParam "status" [String] :> Get '[JSON] [Pet] -- findPetsByStatus :<|> "pet" :> "findByStatus" :> QueryParam "status" [String] :> Get '[JSON] [Pet] -- findPetsByStatus
@ -70,6 +75,8 @@ type PetApi = "pet" :> ReqBody '[JSON] Pet :> Put '[JSON] () -- updatePet
:<|> "pet" :> Capture "petId" String :> ReqBody '[FormUrlEncoded] Formnamestatus :> Post '[JSON] () -- updatePetWithForm :<|> "pet" :> Capture "petId" String :> ReqBody '[FormUrlEncoded] Formnamestatus :> Post '[JSON] () -- updatePetWithForm
:<|> "pet" :> Capture "petId" Integer :> Header "api_key" String :> Delete '[JSON] () -- deletePet :<|> "pet" :> Capture "petId" Integer :> Header "api_key" String :> Delete '[JSON] () -- deletePet
:<|> "pet" :> Capture "petId" Integer :> "uploadImage" :> ReqBody '[FormUrlEncoded] FormadditionalMetadatafile :> Post '[JSON] () -- uploadFile :<|> "pet" :> Capture "petId" Integer :> "uploadImage" :> ReqBody '[FormUrlEncoded] FormadditionalMetadatafile :> Post '[JSON] () -- uploadFile
:<|> "pet" :> Capture "petId" Integer?testing_byte_array=true :> Get '[JSON] Binary -- getPetByIdWithByteArray
:<|> "pet?testing_byte_array=true" :> ReqBody '[JSON] Binary :> Post '[JSON] () -- addPetUsingByteArray
proxyPetApi :: Proxy PetApi proxyPetApi :: Proxy PetApi
proxyPetApi = Proxy proxyPetApi = Proxy
@ -101,4 +108,6 @@ updatePet
:<|> updatePetWithForm :<|> updatePetWithForm
:<|> deletePet :<|> deletePet
:<|> uploadFile :<|> uploadFile
:<|> getPetByIdWithByteArray
:<|> addPetUsingByteArray
= client proxyPetApi $ BaseUrl Http host port = client proxyPetApi $ BaseUrl Http host port

View File

@ -9,8 +9,8 @@ module Apis (
) where ) where
import Api.UserApi (UserApi) import Api.UserApi (UserApi)
import Api.StoreApi (StoreApi)
import Api.PetApi (PetApi) import Api.PetApi (PetApi)
import Api.StoreApi (StoreApi)
import Data.Proxy import Data.Proxy
import Servant.API import Servant.API
@ -18,7 +18,7 @@ import Test.QuickCheck
import qualified Data.Map as Map import qualified Data.Map as Map
import Utils import Utils
type API = UserApi :<|> StoreApi :<|> PetApi type API = UserApi :<|> PetApi :<|> StoreApi
api :: Proxy API api :: Proxy API
api = Proxy api = Proxy