SchemaDSLModule
PackageReified.Schema
The concise schema-definition vocabulary: the record computation expression, its field and constructor
forms, and the collection-schema operations.
Summary
| Name | Signature | Synopsis |
|---|---|---|
| schema | schema | Record-schema computation expression. |
| fieldAs | fieldAs name getter | Declares a field under an explicit wire name, for when the name differs from the property and for portable code. |
| construct | construct constructor | Closes a record schema with a total constructor. |
| constructResult | constructResult constructor | Closes a record schema with a checked constructor. |
| constrainItems | constrainItems constraint' schema | Adds a constraint to every item described by a list schema. |
| constrainValues | constrainValues constraint' schema | Adds a constraint to every value described by a string-keyed map schema. |
Declares a field under an explicit wire name, for when the name differs from the property and for
portable code.
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | |
| getter | 'model -> 'value |
Returns
field<'model, 'value>
Verification Examples
type Signup = { Email: string }
fieldAs "email_address" (fun (s: Signup) -> s.Email)Closes a record schema with a total constructor.
Parameters
| Name | Type | Description |
|---|---|---|
| constructor | 'constructor |
Returns
ConstructorStep<'model, 'constructor>
Closes a record schema with a checked constructor.
Parameters
| Name | Type | Description |
|---|---|---|
| constructor | 'constructor |
Returns
CheckedConstructorStep<'model, 'constructor>
Adds a constraint to every item described by a list schema.
Parameters
| Name | Type | Description |
|---|---|---|
| constraint' | Constraint<'item> | |
| schema | Schema<'item list> |
Returns
Schema<'item list>
Verification Examples
Schema.list () |> constrainItems Constraint.presentAdds a constraint to every value described by a string-keyed map schema.
Parameters
| Name | Type | Description |
|---|---|---|
| constraint' | Constraint<'item> | |
| schema | Schema<Map<string, 'item>> |
Returns
Schema<Map<string, 'item>>
Verification Examples
Schema.map () |> constrainValues Constraint.present