Skip to content

0.8.0

Choose a tag to compare

@zaiev zaiev released this 19 Oct 13:57
· 29 commits to main since this release

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.client prints 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, `Refused or `Unexpected.
  • An event stream's function is handed each event as a variant, read over fetch and stopped with Route.Stream.close.
  • A WebSocket's function is handed each message typed; Route.Socket.send is 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 FILE fails when a committed copy is not what the routes make.
  • Melange is a test dependency only: a native user installs nothing new.