openapi3-code-generator 0.1.0.2 → 0.1.0.3
raw patch · 3 files changed
+98/−87 lines, 3 filesdep ~QuickCheckdep ~aesondep ~bytestring
Dependency ranges changed: QuickCheck, aeson, bytestring, containers, directory, filepath, genvalidity, genvalidity-hspec, genvalidity-text, hashmap, hspec, http-client, http-conduit, http-types, mtl, options, scientific, split, template-haskell, text, time, transformers, unordered-containers, validity, validity-text, vector, yaml
Files
- openapi3-code-generator.cabal +91/−82
- src/OpenAPI/Generate.hs +2/−1
- src/OpenAPI/Generate/Internal/Operation.hs +5/−4
openapi3-code-generator.cabal view
@@ -1,18 +1,24 @@ cabal-version: 1.12-name: openapi3-code-generator-version: 0.1.0.2-license: MIT-license-file: LICENSE-copyright: 2020 Remo Dörig & Joel Fisch-maintainer: Joel Fisch <joel.fisch96@gmail.com> & Remo Dörig <remo.doerig@gmail.com>-author: Remo Dörig & Joel Fisch-homepage: https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator#readme-bug-reports: https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator/issues-synopsis: OpenAPI3 Haskell Client Code Generator-description:- Please see the README on GitHub at <https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator#readme>-category: Code-Generator-build-type: Simple++-- This file has been generated from package.yaml by hpack version 0.33.0.+--+-- see: https://github.com/sol/hpack+--+-- hash: 93f2838ca8b420e4def924dc107fa4b207fabde3bdc91dec0756e97c7e4905f0++name: openapi3-code-generator+version: 0.1.0.3+license: MIT+license-file: LICENSE+copyright: 2020 Remo Dörig & Joel Fisch+maintainer: Joel Fisch <joel.fisch96@gmail.com> & Remo Dörig <remo.doerig@gmail.com>+author: Remo Dörig & Joel Fisch+homepage: https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator#readme+bug-reports: https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator/issues+synopsis: OpenAPI3 Haskell Client Code Generator+description: Please see the README on GitHub at <https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator#readme>+category: Code-Generator+build-type: Simple extra-source-files: README.md ChangeLog.md@@ -41,68 +47,71 @@ OpenAPI.Generate.Types.ExternalDocumentation OpenAPI.Generate.Types.Referencable OpenAPI.Generate.Types.Schema- hs-source-dirs: src+ hs-source-dirs:+ src other-modules: Paths_openapi3_code_generator default-language: Haskell2010 ghc-options: -Wall build-depends:- aeson >=1.4.6.0 && <1.5,+ aeson, base >=4.7 && <5,- bytestring >=0.10.10.0 && <0.11,- containers >=0.6.2.1 && <0.7,- hashmap >=1.3.3 && <1.4,- http-client >=0.6.4 && <0.7,- http-conduit >=2.3.7.3 && <2.4,- http-types >=0.12.3 && <0.13,- mtl >=2.2.2 && <2.3,- options >=1.2.1.1 && <1.3,- scientific >=0.3.6.2 && <0.4,- split >=0.2.3.4 && <0.3,- template-haskell >=2.15.0.0 && <2.16,- text >=1.2.4.0 && <1.3,- time >=1.9.3 && <1.10,- transformers >=0.5.6.2 && <0.6,- unordered-containers >=0.2.10.0 && <0.3,- vector >=0.12.1.2 && <0.13,- yaml >=0.11.2.0 && <0.12+ bytestring,+ containers,+ hashmap,+ http-client,+ http-conduit,+ http-types,+ mtl,+ options,+ scientific,+ split,+ template-haskell,+ text,+ time,+ transformers,+ unordered-containers,+ vector,+ yaml executable openapi3-code-generator-exe main-is: Main.hs- hs-source-dirs: app+ hs-source-dirs:+ app other-modules: Embed Paths_openapi3_code_generator default-language: Haskell2010 ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall build-depends:- aeson >=1.4.6.0 && <1.5,+ aeson, base >=4.7 && <5,- bytestring >=0.10.10.0 && <0.11,- containers >=0.6.2.1 && <0.7,- directory >=1.3.4.0 && <1.4,- filepath >=1.4.2.1 && <1.5,- hashmap >=1.3.3 && <1.4,- http-client >=0.6.4 && <0.7,- http-conduit >=2.3.7.3 && <2.4,- http-types >=0.12.3 && <0.13,- mtl >=2.2.2 && <2.3,- openapi3-code-generator -any,- options >=1.2.1.1 && <1.3,- scientific >=0.3.6.2 && <0.4,- split >=0.2.3.4 && <0.3,- template-haskell >=2.15.0.0 && <2.16,- text >=1.2.4.0 && <1.3,- time >=1.9.3 && <1.10,- transformers >=0.5.6.2 && <0.6,- unordered-containers >=0.2.10.0 && <0.3,- vector >=0.12.1.2 && <0.13,- yaml >=0.11.2.0 && <0.12+ bytestring,+ containers,+ directory,+ filepath,+ hashmap,+ http-client,+ http-conduit,+ http-types,+ mtl,+ openapi3-code-generator,+ options,+ scientific,+ split,+ template-haskell,+ text,+ time,+ transformers,+ unordered-containers,+ vector,+ yaml test-suite openapi3-code-generator-test type: exitcode-stdio-1.0 main-is: Spec.hs- hs-source-dirs: test+ hs-source-dirs:+ test other-modules: OpenAPI.Generate.DocSpec OpenAPI.Generate.Internal.UtilSpec@@ -115,30 +124,30 @@ default-language: Haskell2010 ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall build-depends:- QuickCheck >=2.13.2 && <2.14,- aeson >=1.4.6.0 && <1.5,+ QuickCheck,+ aeson, base >=4.7 && <5,- bytestring >=0.10.10.0 && <0.11,- containers >=0.6.2.1 && <0.7,- genvalidity >=0.10.0.1 && <0.11,- genvalidity-hspec >=0.7.0.4 && <0.8,- genvalidity-text >=0.7.0.2 && <0.8,- hashmap >=1.3.3 && <1.4,- hspec >=2.7.1 && <2.8,- http-client >=0.6.4 && <0.7,- http-conduit >=2.3.7.3 && <2.4,- http-types >=0.12.3 && <0.13,- mtl >=2.2.2 && <2.3,- openapi3-code-generator -any,- options >=1.2.1.1 && <1.3,- scientific >=0.3.6.2 && <0.4,- split >=0.2.3.4 && <0.3,- template-haskell >=2.15.0.0 && <2.16,- text >=1.2.4.0 && <1.3,- time >=1.9.3 && <1.10,- transformers >=0.5.6.2 && <0.6,- unordered-containers >=0.2.10.0 && <0.3,- validity >=0.9.0.3 && <0.10,- validity-text >=0.3.1.1 && <0.4,- vector >=0.12.1.2 && <0.13,- yaml >=0.11.2.0 && <0.12+ bytestring,+ containers,+ genvalidity,+ genvalidity-hspec,+ genvalidity-text,+ hashmap,+ hspec,+ http-client,+ http-conduit,+ http-types,+ mtl,+ openapi3-code-generator,+ options,+ scientific,+ split,+ template-haskell,+ text,+ time,+ transformers,+ unordered-containers,+ validity,+ validity-text,+ vector,+ yaml
src/OpenAPI/Generate.hs view
@@ -48,6 +48,7 @@ defineConfigurationInformation moduleName spec = let servers' = (OAT.servers :: OAT.OpenApiSpecification -> [OAT.ServerObject]) spec defaultURL = getServerURL servers'+ defaultURLStr = T.unpack defaultURL defaultURLName = mkName "defaultURL" getServerURL = maybe "/" (OAT.url :: OAT.ServerObject -> Text) . Maybe.listToMaybe in Doc.addConfigurationModuleHeader moduleName@@ -60,7 +61,7 @@ "@" <> defaultURL <> "@" ], ppr- <$> [d|$(varP defaultURLName) = defaultURL|],+ <$> [d|$(varP defaultURLName) = T.pack defaultURLStr|], pure $ Doc.generateHaddockComment ["The default configuration containing the 'defaultURL' and no authorization"], ppr <$> [d|$(varP $ mkName "defaultConfiguration") = OC.Configuration $(varE defaultURLName) OC.AnonymousSecurityScheme|] ]
src/OpenAPI/Generate/Internal/Operation.hs view
@@ -188,6 +188,7 @@ namedQueryParameters = filter ((== OAT.QueryParameterObjectLocation) . getInFromParameterObject . snd) namedParameters queryParameters = generateQueryParams namedQueryParameters bodyName = mkName "body"+ strMethod = T.unpack method pure $ ppr <$> case bodySchema of Just RequestBodyDefinition {..} ->@@ -203,7 +204,7 @@ then [|OC.doBodyCallWithConfiguration $(varE configArg)|] else [|OC.doBodyCallWithConfigurationM|] )- (T.toUpper method)+ (T.toUpper $ T.pack strMethod) (T.pack $(request)) $(queryParameters) $(if required then [|Just $(varE bodyName)|] else varE bodyName)@@ -218,7 +219,7 @@ then [|OC.doCallWithConfiguration $(varE configArg)|] else [|OC.doCallWithConfigurationM|] )- (T.toUpper method)+ (T.toUpper $ T.pack strMethod) (T.pack $(request)) $(queryParameters) )@@ -297,9 +298,9 @@ -- | Generates query params in the form of [(Text,ByteString)] generateQueryParams :: [(Name, OAT.ParameterObject)] -> Q Exp generateQueryParams ((name, param) : xs) =- infixE (Just [|(queryName, $(expr))|]) (varE $ mkName ":") (Just $ generateQueryParams xs)+ infixE (Just [|(T.pack queryName, $(expr))|]) (varE $ mkName ":") (Just $ generateQueryParams xs) where- queryName = getNameFromParameter param+ queryName = T.unpack $ getNameFromParameter param required = getRequiredFromParameter param expr = if required