From 28a5b74dbf313529a2fc697d46e9ed870cfd6a30 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 2 Oct 2017 23:52:01 +0800 Subject: [PATCH] add partial header to haskell http client (#6606) --- .../haskell-http-client/API.mustache | 1 + .../haskell-http-client/Client.mustache | 1 + .../haskell-http-client/Lens.mustache | 3 +- .../haskell-http-client/LoggingKatip.mustache | 1 + .../LoggingMonadLogger.mustache | 1 + .../haskell-http-client/MimeTypes.mustache | 2 +- .../haskell-http-client/Model.mustache | 3 +- .../haskell-http-client/TopLevel.mustache | 1 + .../partial_header.mustache | 17 ++++++++++ .../lib/SwaggerPetstore.hs | 10 ++++++ .../lib/SwaggerPetstore/API.hs | 10 ++++++ .../lib/SwaggerPetstore/Client.hs | 10 ++++++ .../lib/SwaggerPetstore/Lens.hs | 10 ++++++ .../lib/SwaggerPetstore/Logging.hs | 10 ++++++ .../lib/SwaggerPetstore/MimeTypes.hs | 9 +++++ .../lib/SwaggerPetstore/Model.hs | 12 ++++++- .../petstore/haskell-http-client/swagger.json | 34 +++++++++---------- 17 files changed, 114 insertions(+), 21 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/haskell-http-client/partial_header.mustache diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/API.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/API.mustache index f58699831827..06cad2f8d0c8 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/API.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/API.mustache @@ -1,3 +1,4 @@ +{{>partial_header}} {-| Module : {{title}}.API -} diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/Client.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/Client.mustache index c56f377451be..c2e6655e7903 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/Client.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/Client.mustache @@ -1,3 +1,4 @@ +{{>partial_header}} {-| Module : {{title}}.Client -} diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/Lens.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/Lens.mustache index a10d79faf99b..458c33eb96b2 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/Lens.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/Lens.mustache @@ -1,3 +1,4 @@ +{{>partial_header}} {-| Module : {{title}}.Lens -} @@ -43,4 +44,4 @@ type Lens_ s t a b = forall (f :: * -> *). Functor f => (a -> f b) -> s -> f t {{/vars}} {{/model}} -{{/models}} \ No newline at end of file +{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/LoggingKatip.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/LoggingKatip.mustache index 470df933b09f..3b3877a41ce5 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/LoggingKatip.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/LoggingKatip.mustache @@ -1,3 +1,4 @@ +{{>partial_header}} {-| Module : {{title}}.Logging Katip Logging functions diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/LoggingMonadLogger.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/LoggingMonadLogger.mustache index a9737b70e017..e0a15329c138 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/LoggingMonadLogger.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/LoggingMonadLogger.mustache @@ -1,3 +1,4 @@ +{{>partial_header}} {-| Module : {{title}}.Logging monad-logger Logging functions diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/MimeTypes.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/MimeTypes.mustache index 18a4c99cf3c9..b111a1da1e52 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/MimeTypes.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/MimeTypes.mustache @@ -1,4 +1,4 @@ - +{{>partial_header}} {-| Module : {{title}}.MimeTypes -} diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/Model.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/Model.mustache index 26ce58b91b74..3cf877fd2cef 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/Model.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/Model.mustache @@ -1,3 +1,4 @@ +{{>partial_header}} {-| Module : {{title}}.Model -} @@ -240,4 +241,4 @@ _readBinaryBase64 = P.either P.fail (pure . Binary) . BL64.decode . BL.fromStric _showBinaryBase64 :: Binary -> Text _showBinaryBase64 = T.decodeUtf8 . BL.toStrict . BL64.encode . unBinary -{-# INLINE _showBinaryBase64 #-} \ No newline at end of file +{-# INLINE _showBinaryBase64 #-} diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/TopLevel.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/TopLevel.mustache index 83e2c8ed979a..2522a571fba9 100644 --- a/modules/swagger-codegen/src/main/resources/haskell-http-client/TopLevel.mustache +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/TopLevel.mustache @@ -1,3 +1,4 @@ +{{>partial_header}} {-| Module : {{title}} -} diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/partial_header.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/partial_header.mustache new file mode 100644 index 000000000000..7fc0581b639c --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/partial_header.mustache @@ -0,0 +1,17 @@ +{- + {{#appName}} + {{{appName}}} + + {{/appName}} + {{#appDescription}} + {{{appDescription}}} + + {{/appDescription}} + {{#version}} + OpenAPI spec version: {{{version}}} + {{/version}} + {{#infoEmail}} + Contact: {{{infoEmail}}} + {{/infoEmail}} + Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) +-} diff --git a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore.hs b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore.hs index cb5e7c140c11..6e1700d709bb 100644 --- a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore.hs +++ b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore.hs @@ -1,3 +1,13 @@ +{- + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) +-} + {-| Module : SwaggerPetstore -} diff --git a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/API.hs b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/API.hs index c0408b8fb9ec..320722d1a215 100644 --- a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/API.hs +++ b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/API.hs @@ -1,3 +1,13 @@ +{- + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) +-} + {-| Module : SwaggerPetstore.API -} diff --git a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Client.hs b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Client.hs index b68ce51a7bde..041f7a11013c 100644 --- a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Client.hs +++ b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Client.hs @@ -1,3 +1,13 @@ +{- + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) +-} + {-| Module : SwaggerPetstore.Client -} diff --git a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Lens.hs b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Lens.hs index b645d189d7ab..105cb19b0b26 100644 --- a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Lens.hs +++ b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Lens.hs @@ -1,3 +1,13 @@ +{- + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) +-} + {-| Module : SwaggerPetstore.Lens -} diff --git a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Logging.hs b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Logging.hs index 7ab4bac91861..2842b5ee15f5 100644 --- a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Logging.hs +++ b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Logging.hs @@ -1,3 +1,13 @@ +{- + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) +-} + {-| Module : SwaggerPetstore.Logging Katip Logging functions diff --git a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/MimeTypes.hs b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/MimeTypes.hs index d7abb7681bba..1eac4d19189a 100644 --- a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/MimeTypes.hs +++ b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/MimeTypes.hs @@ -1,3 +1,12 @@ +{- + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) +-} {-| Module : SwaggerPetstore.MimeTypes diff --git a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Model.hs b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Model.hs index 8942406f205a..24e45353039f 100644 --- a/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Model.hs +++ b/samples/client/petstore/haskell-http-client/lib/SwaggerPetstore/Model.hs @@ -1,3 +1,13 @@ +{- + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) +-} + {-| Module : SwaggerPetstore.Model -} @@ -1413,4 +1423,4 @@ _readBinaryBase64 = P.either P.fail (pure . Binary) . BL64.decode . BL.fromStric _showBinaryBase64 :: Binary -> Text _showBinaryBase64 = T.decodeUtf8 . BL.toStrict . BL64.encode . unBinary -{-# INLINE _showBinaryBase64 #-} \ No newline at end of file +{-# INLINE _showBinaryBase64 #-} diff --git a/samples/client/petstore/haskell-http-client/swagger.json b/samples/client/petstore/haskell-http-client/swagger.json index 305643090e8b..4af4303cdb82 100644 --- a/samples/client/petstore/haskell-http-client/swagger.json +++ b/samples/client/petstore/haskell-http-client/swagger.json @@ -108,8 +108,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ "available", "pending", "sold" ], - "default" : "available" + "default" : "available", + "enum" : [ "available", "pending", "sold" ] }, "collectionFormat" : "csv" } ], @@ -680,8 +680,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ ">", "$" ], - "default" : "$" + "default" : "$", + "enum" : [ ">", "$" ] } }, { "name" : "enum_form_string", @@ -699,8 +699,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ ">", "$" ], - "default" : "$" + "default" : "$", + "enum" : [ ">", "$" ] } }, { "name" : "enum_header_string", @@ -718,8 +718,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ ">", "$" ], - "default" : "$" + "default" : "$", + "enum" : [ ">", "$" ] } }, { "name" : "enum_query_string", @@ -1662,15 +1662,6 @@ "type" : "string", "enum" : [ "placed", "approved", "delivered" ] }, - "OuterNumber" : { - "type" : "number" - }, - "OuterString" : { - "type" : "string" - }, - "OuterBoolean" : { - "type" : "boolean" - }, "OuterComposite" : { "type" : "object", "properties" : { @@ -1684,6 +1675,15 @@ "$ref" : "#/definitions/OuterBoolean" } } + }, + "OuterNumber" : { + "type" : "number" + }, + "OuterString" : { + "type" : "string" + }, + "OuterBoolean" : { + "type" : "boolean" } }, "externalDocs" : {