package contract
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Typed HTTP API contracts for OCaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
0.1.0.tar.gz
md5=c51c9108224fdadd034d5f6f405624db
sha512=5a8cb930abdc33382051b392caea40af98da35e82befc5a1c13374565178c6b91e4371758daa60062063540306672a8064ff3ca185d0ab93934be724ec52a58d
doc/README.html
contract
contract is an OCaml library for describing HTTP API contracts as typed values. The current code covers a small pure core: endpoint definitions, path matching, scalar and JSON decoding, request validation, and OpenAPI output.
Current MVP
This version is a thin vertical slice for REST-style JSON APIs. It has no HTTP server dependency. A request is just a value passed to the validator. Path parameters are percent-decoded after route matching.
See examples/users_api.ml for a small users API with GET /users/:id and POST /users.
dune exec examples/users_api.exeBuild and test:
dune build @all
dune runtestCurrent limitations:
- no real HTTP adapter yet
- no typed client yet
- no OpenAPI import yet
- no mock server yet
- no response validation yet
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page