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.elmmodule; Requests for making HTTP requests. This type splits the nativeHttp.requestinto two: (1) define the request to be made and (2) create a command to send the request resulting in aMsg.
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:
dateanddate-timerequire elm/time and rtfeldman/elm-iso8601-date-strings (imported inApi/Time.elm);uuidrequires danyx23/elm-uuid.
The next sections give some examples on OpenAPI specifications and the corresponding generated Elm code.