This is a command line tool that allows you to generate OCaml code for and inspect OpenAPI specifications.
The generator makes a number of assumptions that, if held true, should result in functional generated code, even if it's not ideal (e.x. types may be Jsonaf.t instead of a reasonable typed OCaml type in all cases).
If your spec is in YAML, just convert it to JSON first before putting it in this tool.
$ openapi.exe generate -name example_generated -out $CODE_OUTPUT_PATH -spec $SPEC_JSONThe generated code requires you to pass in a Openapi_runtime.Client.t, which can be created with any arbitrary backend (Httpaf, Cohttp, etc.).
$ openapi.exe inspect paths -spec $SPEC_JSON
/v1/foobar
GET: Obtain foobar
POST: Create foobar
/v1/foobar/{baz}
GET: Fetch baz
DELETE: Delete baz
/v1/foobar/{baz}/import
POST: Import baz
...It's probably easier to just generate the OCaml code and look at the types that way, but this gives you a summary of some internal state of the type inference engine, which may be useful for debugging.
$ openapi.exe inspect types -spec $SPEC_JSON
((name Foo_request) (structure (Record ((id 0))))
(variant_name ()))
((name Bar_submit) (structure (Record ((id 3) (baz_count 4))))
(variant_name ()))
((name Error)
(structure (Record ((message 7) (id 8))))
(variant_name ()))
...