Hi! This is a full top-to-bottom example for using Tie.
Run the following command from the example/ directory of the Tie repository:
$ cabal runThis will build and launch a webserver on port 8080.
Run the following command from the example/ directory of the Tie repository:
$ tie --output generated --module-name Petstore.API --package-name petstore-api petstore.yamlThis will generate a Cabal package into the generated directory.
The generated code will placed in generated. The modules are placed under the Petstore.API (PetStore/API) Haskell module namespace.
-
generated/Petstore/API/Api.hscontains the API definition for the Petstore. This file is derived from the operations defined in the OpenAPI specification. In particular, the operation names are derived from theoperationIdproperty of the Operations as defined in the specification. -
generated/Petstore/API/Schemasis where the schema definitions are being placed by Tie. You can find the definition forPetandPetsas well asErrorin here. -
generated/Petstore/API/Responseis where Tie places the response types for the individual operations. You will find a Haskell module for each operation in the OpenAPI specification here. -
app/Main.hsis the entry point of the example Petstore application. It provides an implementation for the generatedApitype and spins up a Warp webserver.