diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellHttpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellHttpClientCodegen.java
index cd60a221aec..5f57e100c50 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellHttpClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/HaskellHttpClientCodegen.java
@@ -128,7 +128,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("stack.mustache", "", "stack.yaml"));
supportingFiles.add(new SupportingFile("Setup.mustache", "", "Setup.hs"));
- supportingFiles.add(new SupportingFile(".gitignore", "", ".gitignore"));
+ supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
supportingFiles.add(new SupportingFile(".travis.yml", "", ".travis.yml"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
@@ -241,7 +241,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
public void setDateFormat(String value) {
if (StringUtils.isBlank(value)) {
- additionalProperties.remove(DATE_FORMAT);
+ additionalProperties.put(DATE_FORMAT, defaultDateFormat);
} else {
additionalProperties.put(DATE_FORMAT, value);
}
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 4df5c4a8cdd..3ac0727fe49 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
@@ -29,8 +29,6 @@ import {{title}}.Model
-- * Type Aliases
-type Traversal_' s a = Traversal_ s s a a
-type Traversal_ s t a b = forall (f :: * -> *). Applicative f => (a -> f b) -> s -> f t
type Lens_' s a = Lens_ s s a a
type Lens_ s t a b = forall (f :: * -> *). Functor f => (a -> f b) -> s -> f t
@@ -40,27 +38,12 @@ type Lens_ s t a b = forall (f :: * -> *). Functor f => (a -> f b) -> s -> f t
-- * {{classname}}
{{#vars}}
-{{#required}}
-- | '{{name}}' Lens
-{{name}}L :: Lens_' {{classname}} {{datatype}}
+{{name}}L :: Lens_' {{classname}} ({{^required}}Maybe {{/required}}{{datatype}})
{{name}}L f {{classname}}{..} = (\{{name}} -> {{classname}} { {{name}}, ..} ) <$> f {{name}}
{-# INLINE {{name}}L #-}
-{{/required}}
-{{^required}}
--- | '{{name}}' Traversal
-{{name}}T :: Traversal_' {{classname}} {{datatype}}
-{{name}}T f s = _mtraversal {{name}} (\b -> s { {{name}} = Just b}) f s
-{-# INLINE {{name}}T #-}
-{{/required}}
{{/vars}}
{{/model}}
-{{/models}}
-
-
--- * Helpers
-
-_mtraversal :: Applicative f => (b -> Maybe t) -> (a -> b) -> (t -> f a) -> b -> f b
-_mtraversal x fsb f s = maybe (pure s) (\a -> fsb <$> f a) (x s)
-{-# INLINE _mtraversal #-}
+{{/models}}
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/README.mustache b/modules/swagger-codegen/src/main/resources/haskell-http-client/README.mustache
index 39c9c6d457d..4a32daa917c 100644
--- a/modules/swagger-codegen/src/main/resources/haskell-http-client/README.mustache
+++ b/modules/swagger-codegen/src/main/resources/haskell-http-client/README.mustache
@@ -62,16 +62,16 @@ These options allow some customization of the code generation process.
**haskell-http-client specific options:**
-| OPTION | DESCRIPTION | DEFAULT | ACTUAL |
-| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------- |
-| allowFromJsonNulls | allow JSON Null during model decoding from JSON | true | {{allowFromJsonNulls}} |
-| allowToJsonNulls | allow emitting JSON Null during model encoding to JSON | false | {{allowToJsonNulls}} |
-| dateFormat | format string used to parse/render a date | %Y-%m-%d | {{dateFormat}} |
-| dateTimeFormat | format string used to parse/render a datetime. (Defaults to [formatISO8601Millis][1] when not provided) | | {{dateTimeFormat}} |
-| generateFormUrlEncodedInstances | Generate FromForm/ToForm instances for models used by x-www-form-urlencoded operations (model fields must be primitive types) | true | {{generateFormUrlEncodedInstances}} |
-| generateLenses | Generate Lens optics for Models | true | {{generateLenses}} |
-| generateModelConstructors | Generate smart constructors (only supply required fields) for models | true | {{generateModelConstructors}} |
-| modelDeriving | Additional classes to include in the deriving() clause of Models | | {{modelDeriving}} |
+| OPTION | DESCRIPTION | DEFAULT | ACTUAL |
+| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------- |
+| allowFromJsonNulls | allow JSON Null during model decoding from JSON | true | {{{allowFromJsonNulls}}} |
+| allowToJsonNulls | allow emitting JSON Null during model encoding to JSON | false | {{{allowToJsonNulls}}} |
+| dateFormat | format string used to parse/render a date | %Y-%m-%d | {{{dateFormat}}} |
+| dateTimeFormat | format string used to parse/render a datetime. (Defaults to [formatISO8601Millis][1] when not provided) | | {{{dateTimeFormat}}} |
+| generateFormUrlEncodedInstances | Generate FromForm/ToForm instances for models used by x-www-form-urlencoded operations (model fields must be primitive types) | true | {{{generateFormUrlEncodedInstances}}} |
+| generateLenses | Generate Lens optics for Models | true | {{{generateLenses}}} |
+| generateModelConstructors | Generate smart constructors (only supply required fields) for models | true | {{{generateModelConstructors}}} |
+| modelDeriving | Additional classes to include in the deriving() clause of Models | | {{{modelDeriving}}} |
[1]: https://www.stackage.org/haddock/lts-9.0/iso8601-time-0.1.4/Data-Time-ISO8601.html#v:formatISO8601Millis
@@ -85,13 +85,13 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help
An example of the generated haddock documentation targeting the server http://petstore.swagger.io/ (SwaggerPetstore) can be found [here][2]
-[2]: https://jonschoning.github.io/swaggerpetstore-haskell-http-client/
+[2]: https://hackage.haskell.org/package/swagger-petstore
### Example SwaggerPetstore App
An example application using the auto-generated haskell-http-client bindings for the server http://petstore.swagger.io/ can be found [here][3]
-[3]: https://github.com/jonschoning/swagger-codegen/tree/haskell-http-client/samples/client/petstore/haskell-http-client/example-app
+[3]: https://github.com/swagger-api/swagger-codegen/tree/c7d145a4ba3c0627e04ece9eb97e354ac91be821/samples/client/petstore/haskell-http-client/example-app
### Usage Notes
@@ -103,22 +103,23 @@ This library is intended to be imported qualified.
| {{title}}.API | construct requetss |
| {{title}}.Model | describes models |
| {{title}}.MimeTypes | encoding/decoding MIME types (content-types/accept) |
-| {{title}}.Lens | lenses & traversals for model fields |
+| {{title}}.Lens | lenses for model fields |
This library adds type safety around what swagger specifies as
Produces and Consumes for each Operation (e.g. the list of MIME types an
Operation can Produce (using 'accept' headers) and Consume (using 'content-type' headers).
For example, if there is an Operation named _addFoo_, there will be a
-data type generated named _AddFoo_ (note the capitalization) which
-describes additional constraints and actions on the _addFoo_
-operation, which can be viewed in GHCi or via the Haddocks.
+data type generated named _AddFoo_ (note the capitalization), which
+describes additional constraints and actions on the _addFoo_ operation
+via its typeclass instances. These typeclass instances can be viewed
+in GHCi or via the Haddocks.
* requried parameters are included as function arguments to _addFoo_
* optional non-body parameters are included by using `applyOptionalParam`
* optional body parameters are set by using `setBodyParam`
-Example for pretend _addFoo_ operation:
+Example code generated for pretend _addFoo_ operation:
```haskell
data AddFoo
diff --git a/modules/swagger-codegen/src/main/resources/haskell-http-client/.gitignore b/modules/swagger-codegen/src/main/resources/haskell-http-client/gitignore.mustache
similarity index 100%
rename from modules/swagger-codegen/src/main/resources/haskell-http-client/.gitignore
rename to modules/swagger-codegen/src/main/resources/haskell-http-client/gitignore.mustache
diff --git a/samples/client/petstore/haskell-http-client/README.md b/samples/client/petstore/haskell-http-client/README.md
index d1ee4f9c200..817c834271d 100644
--- a/samples/client/petstore/haskell-http-client/README.md
+++ b/samples/client/petstore/haskell-http-client/README.md
@@ -62,11 +62,11 @@ These options allow some customization of the code generation process.
**haskell-http-client specific options:**
-| OPTION | DESCRIPTION | DEFAULT | ACTUAL |
-| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------- |
+| OPTION | DESCRIPTION | DEFAULT | ACTUAL |
+| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------- |
| allowFromJsonNulls | allow JSON Null during model decoding from JSON | true | true |
| allowToJsonNulls | allow emitting JSON Null during model encoding to JSON | false | false |
-| dateFormat | format string used to parse/render a date | %Y-%m-%d | |
+| dateFormat | format string used to parse/render a date | %Y-%m-%d | %Y-%m-%d |
| dateTimeFormat | format string used to parse/render a datetime. (Defaults to [formatISO8601Millis][1] when not provided) | | |
| generateFormUrlEncodedInstances | Generate FromForm/ToForm instances for models used by x-www-form-urlencoded operations (model fields must be primitive types) | true | true |
| generateLenses | Generate Lens optics for Models | true | true |
@@ -85,13 +85,13 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help
An example of the generated haddock documentation targeting the server http://petstore.swagger.io/ (SwaggerPetstore) can be found [here][2]
-[2]: https://jonschoning.github.io/swaggerpetstore-haskell-http-client/
+[2]: https://hackage.haskell.org/package/swagger-petstore
### Example SwaggerPetstore App
An example application using the auto-generated haskell-http-client bindings for the server http://petstore.swagger.io/ can be found [here][3]
-[3]: https://github.com/jonschoning/swagger-codegen/tree/haskell-http-client/samples/client/petstore/haskell-http-client/example-app
+[3]: https://github.com/swagger-api/swagger-codegen/tree/c7d145a4ba3c0627e04ece9eb97e354ac91be821/samples/client/petstore/haskell-http-client/example-app
### Usage Notes
@@ -103,22 +103,23 @@ This library is intended to be imported qualified.
| SwaggerPetstore.API | construct requetss |
| SwaggerPetstore.Model | describes models |
| SwaggerPetstore.MimeTypes | encoding/decoding MIME types (content-types/accept) |
-| SwaggerPetstore.Lens | lenses & traversals for model fields |
+| SwaggerPetstore.Lens | lenses for model fields |
This library adds type safety around what swagger specifies as
Produces and Consumes for each Operation (e.g. the list of MIME types an
Operation can Produce (using 'accept' headers) and Consume (using 'content-type' headers).
For example, if there is an Operation named _addFoo_, there will be a
-data type generated named _AddFoo_ (note the capitalization) which
-describes additional constraints and actions on the _addFoo_
-operation, which can be viewed in GHCi or via the Haddocks.
+data type generated named _AddFoo_ (note the capitalization), which
+describes additional constraints and actions on the _addFoo_ operation
+via its typeclass instances. These typeclass instances can be viewed
+in GHCi or via the Haddocks.
* requried parameters are included as function arguments to _addFoo_
* optional non-body parameters are included by using `applyOptionalParam`
* optional body parameters are set by using `setBodyParam`
-Example for pretend _addFoo_ operation:
+Example code generated for pretend _addFoo_ operation:
```haskell
data AddFoo
diff --git a/samples/client/petstore/haskell-http-client/docs.sh b/samples/client/petstore/haskell-http-client/docs.sh
deleted file mode 100755
index 5db07846482..00000000000
--- a/samples/client/petstore/haskell-http-client/docs.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-set -e
-
-cabal_file=$(find . -maxdepth 1 -name "*.cabal" -print -quit)
-
-if [ ! -f "$cabal_file" ]; then
- echo "Run this script in the top-level package directory"
- exit 1
-fi
-
-pkg=$(awk -F ":[[:space:]]*" 'tolower($1)=="name" { print $2 }' < "$cabal_file")
-ver=$(awk -F ":[[:space:]]*" 'tolower($1)=="version" { print $2 }' < "$cabal_file")
-
-if [ -z "$pkg" ]; then
- echo "Unable to determine package name"
- exit 1
-fi
-
-if [ -z "$ver" ]; then
- echo "Unable to determine package version"
- exit 1
-fi
-
-echo "Detected package: $pkg-$ver"
-
-cabal haddock --hyperlink-source --html-location='https://www.stackage.org/haddock/nightly-2017-08-25/$pkg-$version' --contents-location='https://www.stackage.org/nightly-2017-08-25/package/$pkg-$version'
-
-dir="build-docs"
-trap 'rm -r "$dir"' EXIT
-mkdir -p $dir
-cp -R dist/doc/html/$pkg/ $dir/$pkg-$ver-docs
diff --git a/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-Lens.html b/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-Lens.html
index 483f5a824b7..ccc05213f5d 100644
--- a/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-Lens.html
+++ b/samples/client/petstore/haskell-http-client/docs/SwaggerPetstore-Lens.html
@@ -1,4 +1,4 @@