Repository F# setup
open Reified
open Reified.Refinements
open Reified.Result
open Reified.Schema.JsonWalkthrough: Reference Apps
The reference apps exercise the schema group the way an application does — values crossing CLI, form, JSON, and storage boundaries — so that API friction invisible in a snippet has nowhere to hide. Two tiers are runnable here:
Reified.ReferenceApp.Intro— plainResult, checks, refined values, and accumulated validation, with no schemas at all. Start there if you are new; this page covers the schema tier.examples/Reified.ReferenceApp.Wire— boundary discipline with the wire tier generated from[<DeriveSchema>]records.
The generated-wire slice
dotnet run --project examples/Reified.ReferenceApp.Wire/Reified.ReferenceApp.Wire.fsproj --nologo
The wire slice answers the question the hand-written tier leaves open: what does the day-to-day authoring experience look like once wire schemas are generated? You own an ordinary record with constraint attributes:
[<DeriveSchema>]
type WorkspaceCard =
{ [<Min 1; Max 60>] Name: string
[<Email; SchemaName "owner_email">] OwnerEmail: string
[<Default "private">] Visibility: Visibility
[<Distinct>] Members: string list }
// Called by the generated schema instead of a record literal.
[<SchemaConstructor>]
static member create name (ownerEmail: string) visibility members =
{ Name = name; OwnerEmail = ownerEmail.ToLowerInvariant(); Visibility = visibility; Members = members }schemagen writes the sibling workspace.g.fs: the schema pipeline you would have written by hand, parse and
validate, typed Fields references, and — because WorkspaceCardV1/WorkspaceCard follow the version-chain
naming convention — a WorkspaceCard.contract builder that takes your typed v1 → v2 migration. The hand-written
surface shrinks to exactly the parts that carry meaning: the migration, the strict domain mapping (TrustedCard
rejects an owner listed as a member — a rule the wire deliberately cannot express), and a head-version write
through a compiled codec. Generated schemas are ordinary schemas, so JsonSchema.generate and Json.compile
come along for free.
See Versioned Contracts for the full attribute vocabulary, the
.contract grammar alternative, and running generation in your build with Reified.Schema.Contracts.Build.