Generated code

The generated Elm code consists of two major parts:

  • Types, i.e. records (type aliases) and custom types with or without data. All types are written to the Api/Data.elm module;
  • Requests for making HTTP requests. This type splits the native Http.request into two: (1) define the request to be made and (2) create a command to send the request resulting in a Msg.

The OpenAPI generator also generates a base module Api.elm containing the Request type and several useful library functions. The most important is the send function that allows you to convert a Request to a Cmd msg. See Customization for more advanced usages.

The generator uses as little dependencies as possible. However, when using one of the following OpenAPI formats you will need to load additional libraries:

The next sections give some examples on OpenAPI specifications and the corresponding generated Elm code.

results matching ""

    No results matching ""