rescript-rest@0.4.1 released!
It comes with type-safe responses support. There’s still a big list of possible features, but from this moment, I’d call rescript-rest ready to be used in real projects 
Check the updated documentation: GitHub - DZakh/rescript-rest: ReScript RPC-like client, contract, and server implementation for a pure REST API
I’ve included examples for different use cases.
Here’s the part for Responses:
Responses
Responses are described as an array of response definitions. It’s possible to assign the definition to a specific status using s.status method.
let createPost = Rest.route(() => {
path: "/posts",
method: "POST",
variables: _ => (),
responses: [
s => {
s.status(#201)
Ok(s.data(postSchema))
},
s => {
s.status(#404)
Error(s.field("message", S.string))
},
],
})
You can use s.status multiple times. To define a range of response statuses, you may use 1XX, 2XX, 3XX, 4XX and 5XX. If s.status is not used in a response definition, it’ll be treated as a default case, accepting a response with any status code.
let createPost = Rest.route(() => {
path: "/posts",
method: "POST",
variables: _ => (),
responses: [
s => {
s.status(#201)
Ok(s.data(postSchema))
},
s => {
s.status(#404)
Error(s.field("message", S.string))
},
s => {
s.status(#"5XX")
Error("Server Error")
},
s => Error("Unexpected Error"),
],
})