2022-06-20 13:10:34 +03:00
|
|
|
<h1 align="center">
|
|
|
|
<img src="/assets/tie.svg" width="300" />
|
2022-06-24 21:45:42 +03:00
|
|
|
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=bc48832f-871e-4165-8f5c-539748589cbe" />
|
2022-06-20 13:10:34 +03:00
|
|
|
</h1>
|
2022-03-09 18:42:39 +03:00
|
|
|
|
2022-06-12 19:10:56 +03:00
|
|
|
Tie allows generation of Haskell server stubs from
|
|
|
|
[OpenAPI (v 3.x) specifications](https://swagger.io/specification/).
|
2022-03-09 18:42:39 +03:00
|
|
|
|
2022-06-12 19:10:56 +03:00
|
|
|
If you are looking for a generator for Haskell client code, check out the
|
|
|
|
[Haskell-OpenAPI-Client-Code-Generator](https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator)
|
|
|
|
project.
|
|
|
|
|
2022-06-13 14:36:59 +03:00
|
|
|
## Usage
|
|
|
|
|
2022-06-13 15:31:33 +03:00
|
|
|
```
|
|
|
|
$ tie --help
|
|
|
|
tie - openapi3 server code generator
|
2022-06-13 14:36:59 +03:00
|
|
|
|
|
|
|
Usage: tie [-o|--output DIR] [--module-name MODULE] [--package-name PACKAGE]
|
|
|
|
[--extra-package PACKAGE] FILE
|
2022-06-13 15:31:33 +03:00
|
|
|
|
2022-06-13 14:36:59 +03:00
|
|
|
Generate a Haskell server from an OpenAPI3 specification
|
2022-06-13 15:31:33 +03:00
|
|
|
|
|
|
|
Available options:
|
|
|
|
-o,--output DIR The directory output (default: "out")
|
|
|
|
--module-name MODULE Name of the generated top level module
|
|
|
|
(default: "OpenAPI")
|
|
|
|
--package-name PACKAGE Name of the generated cabal project
|
|
|
|
(default: "open-api")
|
|
|
|
--extra-package PACKAGE Extra packages to include in the generated cabal
|
|
|
|
project
|
|
|
|
FILE OpenAPI specification file
|
|
|
|
-h,--help Show this help text
|
2022-06-13 14:36:59 +03:00
|
|
|
```
|
|
|
|
|
2022-06-25 10:53:35 +03:00
|
|
|
## Example
|
|
|
|
|
|
|
|
See [`example/`](/example) for the ubiquitous OpenAPI Petstore example.
|
|
|
|
|
2022-06-13 23:48:28 +03:00
|
|
|
## Installation
|
2022-06-13 14:36:59 +03:00
|
|
|
|
|
|
|
### Building from source
|
2022-03-09 18:42:39 +03:00
|
|
|
|
2022-06-12 15:39:37 +03:00
|
|
|
Below are the steps to install Tie using the Cabal build tool.
|
|
|
|
|
|
|
|
First, you need to clone the repository
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ git clone https://github.com/scarf-sh/tie.git
|
|
|
|
$ cd tie
|
|
|
|
```
|
|
|
|
|
|
|
|
Then, you need to build it using cabal:
|
|
|
|
|
|
|
|
```bash
|
2022-06-12 19:10:56 +03:00
|
|
|
$ cabal build exe:tie
|
2022-06-12 15:39:37 +03:00
|
|
|
```
|
|
|
|
|
2022-06-12 19:10:56 +03:00
|
|
|
Finally, you can copy the resulting executable to your desired location:
|
2022-06-12 15:39:37 +03:00
|
|
|
|
|
|
|
```bash
|
|
|
|
$ cp $(cabal exec -- which tie) ~/.local/bin/tie
|
2022-03-09 18:42:39 +03:00
|
|
|
```
|
2022-06-12 15:39:37 +03:00
|
|
|
|
2022-06-12 19:10:56 +03:00
|
|
|
Alternatively, instead of manually copying the executable you can install with
|
|
|
|
cabal:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ cabal install .
|
|
|
|
```
|
|
|
|
|
|
|
|
## Community & Contact
|
2022-06-12 15:39:37 +03:00
|
|
|
|
2022-06-12 19:10:56 +03:00
|
|
|
Feel free to join on us on our
|
2022-06-13 14:36:59 +03:00
|
|
|
[community Slack](https://tinyurl.com/scarf-community-slack) (`#tie` channel)!
|
2022-06-12 15:39:37 +03:00
|
|
|
|
2022-06-12 19:10:56 +03:00
|
|
|
## License
|
2022-06-12 15:39:37 +03:00
|
|
|
|
2022-06-12 19:10:56 +03:00
|
|
|
This program is under the terms of the [Apache License v2.0](/LICENSE).
|
2022-06-12 15:39:37 +03:00
|
|
|
|
2022-06-12 19:10:56 +03:00
|
|
|
## Authors
|
2022-06-12 15:39:37 +03:00
|
|
|
|
2022-06-12 19:10:56 +03:00
|
|
|
Tie is originally made and currently sponsored by [Scarf](https://scarf.sh)
|
|
|
|
among other [contributors](https://github.com/scarf-sh/tie/graphs/contributors).
|