Repository F# setup
open Reified
open Reified.Refinements
open Reified.Result
open Reified.Schema.JsonF# libraries for .NET and Fable JavaScript
Encode each invariant once. Enforce it across the project.
Declare a rule once — on a value, a field, or a whole model — and the checking, the diagnostics, the JSON codec, the contract document, and the test data are all read from that one declaration.
type Signup = { Email: string; Age: int; Newsletter: bool }
let signupSchema =
schema<Signup> {
field _.Email { constraints [ present; email ] }
field _.Age { constrain (atLeast 13) }
field _.Newsletter
construct (fun email age newsletter ->
{ Email = email; Age = age; Newsletter = newsletter })
}
Schema.parse signupSchema input
// age: Expected a value at least 13, but was 11.
// email: Expected an email address, but was ada.
// newsletter: This value was omitted.
Json.serialize (Json.compile signupSchema) signup
// {"email":"ada@example.org","age":36,"newsletter":true}Every failure message, the JSON codec, the JSON Schema, and the generated test data come from that one declaration. Nothing above is written twice.
Route by symptom
| Problem | Goes to |
|---|---|
| Validation boilerplate is everywhere, and invalid values still get through | Constraints |
| The same rule is repeated in a parser, a form, and a test | Schema |
| Decoding and validation are separate steps that drift apart | JSON Codecs |
| Constructing structured test data by hand is slow and repetitive | Data |
| You want one small library, not a framework | Packages and platforms |
Every package is independently installable and runs on .NET and on Fable JavaScript — take one capability or the whole set. Packages and platforms →