Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !3446

[OCaml] new client generator

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/cgensoul/ocaml-client into master Jul 24, 2019
  • Overview 0
  • Commits 40
  • Pipelines 0
  • Changes 106

Created by: cgensoul

#1159 (closed) Add OCaml client code generation support

This PR answers #1159 (closed) and adds OCaml Client code generation to openapi-generator. The generated OCaml project relies on the dune tool for the build process and uses :

  • cohttp as the http client lib using the lwt_unix backend (lwt is a future lib for OCaml, a competing future lib is Async which Cohttp supports as well but this generator only target the lwt implementation for now)
  • yojson as the JSon serialization lib
  • ppx_deriving_yojson for automatic generation of JSon serializers and deserializers for generated types
  • ppx_deriving.std for automatic generation of string convertion functions for generated types

It supports headers params, path params, query params, form params and body params. It currently has no support for authentication, nor file upload.

It generates one model file per OAS definition except for OAS enum definitions for which no model file is generated. Enums are treated globally and are all generated in a enums.ml file that contains one type per distinct enumeration present in the input file, even for enumerations that are not proper definitions but just local restrictions on a string parameter of an operation.

Note that generating one model file per OAS definition will work as long as there are no mutually recursive OAS definitions in the input file. Otherwise the generated OCaml code will not compile since it will generate mutually recursive compilation units which is not supported by the language.

For APIs files, both an implementation (.ml) and an interface (.mli) files are generated.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/cgensoul/ocaml-client