SchemaDSLModule

PackageReified.Schema
The concise schema-definition vocabulary: the record computation expression, its field and constructor forms, and the collection-schema operations.

Summary

NameSignatureSynopsis
schemaschema Record-schema computation expression.
fieldAsfieldAs name getterDeclares a field under an explicit wire name, for when the name differs from the property and for portable code.
constructconstruct constructorCloses a record schema with a total constructor.
constructResultconstructResult constructorCloses a record schema with a checked constructor.
constrainItemsconstrainItems constraint' schemaAdds a constraint to every item described by a list schema.
constrainValuesconstrainValues constraint' schemaAdds a constraint to every value described by a string-keyed map schema.

schema

schema
Member
Record-schema computation expression.

Returns

SchemaBuilder<'model>

fieldAs

fieldAs name getter
Member
Declares a field under an explicit wire name, for when the name differs from the property and for portable code.

Parameters

NameTypeDescription
namestring
getter'model -> 'value

Returns

field<'model, 'value>

Verification Examples

type Signup = { Email: string }
 fieldAs "email_address" (fun (s: Signup) -> s.Email)

construct

construct constructor
Member
Closes a record schema with a total constructor.

Parameters

NameTypeDescription
constructor'constructor

Returns

ConstructorStep<'model, 'constructor>

constructResult

constructResult constructor
Member
Closes a record schema with a checked constructor.

Parameters

NameTypeDescription
constructor'constructor

Returns

CheckedConstructorStep<'model, 'constructor>

constrainItems

constrainItems constraint' schema
Member
Adds a constraint to every item described by a list schema.

Parameters

NameTypeDescription
constraint'Constraint<'item>
schemaSchema<'item list>

Returns

Schema<'item list>

Verification Examples

Schema.list () |> constrainItems Constraint.present

constrainValues

constrainValues constraint' schema
Member
Adds a constraint to every value described by a string-keyed map schema.

Parameters

NameTypeDescription
constraint'Constraint<'item>
schemaSchema<Map<string, 'item>>

Returns

Schema<Map<string, 'item>>

Verification Examples

Schema.map () |> constrainValues Constraint.present