package openapi

  1. Overview
  2. No Docs
Openapi documentation generation for Opium

Install

Dune Dependency

Authors

Maintainers

Sources

openapi-v0.6.0.tbz
sha256=69fe5f6a245b5c977ff09ba52174bd67684283fadf4cb5d6608d6ad08b0ada3b
sha512=22f81e87e5614e7e98a80914fa6e104bb15446003804dc94af0b95902fc1ad96b5e66fa9c072aa5e09e886ba0a066285f49875e1be0ce4b77399f9a4951d6d16

README.md.html

Openapi for Ocaml

This library provides basic types for parsing/serializing openapi specifications and a nearly drop-in replacement for Opium.App that registers endpoints in a specification and serves openapi.json and docs pages based on the fastapi implementation.

Usage

Basic usage should work equivalently to Opium.App. So instead of

let open Opium in
App.empty
|> App.get "/path/:foo" (fun h -> Response.of_plain_text "hello world")
|> App.run_command

Just do:

let open Opium in
let module App = Openapi.App in
App.empty
|> App.get "/path/:foo" (fun h -> Response.of_plain_text "hello world")
|> App.run_command

The endpoint creation methods provided by Openapi.Opium.App accept additional optional arguments to provide specification information for to document the endpoint. Check the type signatures of these methods for more information.

Demo App

This library includes a demo app in bin/demo (that won't be installed by opam). To see the generated spec/documentation in action, run:

$ dune build
$ ./_build/default/bin/demo.exe

Then browse to http://localhost:8888/docs

OCaml

Innovation. Community. Security.