openapi3-code-generator: OpenAPI3 Haskell Client Code Generator

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Please see the README on GitHub at

[Skip to Readme]


Change log
Dependencies aeson, base (>=4.7 && <5), 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 [details]
License MIT
Copyright 2020 Remo Dörig & Joel Fisch
Author Remo Dörig & Joel Fisch
Maintainer Joel Fisch <> & Remo Dörig <>
Category Code-Generator
Home page
Bug tracker
Source repo head: git clone
Uploaded by remo_doerig at 2020-05-27T06:07:45Z



Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Readme for openapi3-code-generator-

[back to package description]



How to use?

  1. install stack
  2. stack install openapi3-code-generator
  3. openapi3-code-generator my_specification.yml

An out directory is created with the generated code. Hint you can use --output-dir to specify another output directory. You can use openapi3-code-generator --help to list all CLI options.

Example package

In the folder example is a package that uses the generated code from specifications/petstore.yml. You can run stack test inside the example directory to run the code, it calls the server "" with some sample data. uses this code generator to generate a Stripe API client.


The documentation for the code can be found at This package was created as part of a bachelor thesis. This thesis can be found here TODO.

Large specifications

For large specifications some modules (CyclicTypes.hs for example) can get pretty big. It may be necessary to use --fast with stack build --fast to build the code.

Module structure of the generated code.

All symbols are globally unique and are reexported in the module OpenAPI (Module name can be changed with --module-name). To reduce compile time, the code is split up into multiple modules. Mainly for every operation and for every schema. Schemas with cyclic dependencies are are in the module OpenAPI.CyclicTypes.

Troubleshooting naming conflicts

Naming conflicts can happen, sometimes a little manual adjustment is needed. With the following options naming conflicts can be resolved.