Repository navigation
0.8.0
A typed OCaml client for Melange, printed from the routes, so a browser written in OCaml calls the server with the server's own types.
Upgrading
- Spindle needs wiretype 0.6.
New
Spindle.Melange.clientprints the routes as one OCaml module for Melange, from the same walk as the OpenAPI document and the Zod schemas.- Each route is a function with labelled, typed inputs, answering a promise of a
result: the answer, or`Invalid,`Lost,`Refusedor`Unexpected. - An event stream's function is handed each event as a variant, read over
fetchand stopped withRoute.Stream.close. - A WebSocket's function is handed each message typed;
Route.Socket.sendis typed, checked, and held until the socket opens. - A socket that reads a header, and a route answering a response of any kind, get no function.
myapp api melange [-o FILE]writes the client;api check --melange FILEfails when a committed copy is not what the routes make.- Melange is a test dependency only: a native user installs nothing new.