SchemaCheckModule
PackageReified.Schema
Functions for running executable value checks against refined and primitive value schemas.
Summary
| Name | Signature | Synopsis |
|---|---|---|
| fromUnderlying | SchemaCheck.fromUnderlying constraint' schema | Adapts a check over a schema's underlying primitive representation into a check over the schema's values. |
| complete | SchemaCheck.complete schema | Runs each complete constraint against the value at the refinement layer where it was attached. |
| text | SchemaCheck.text schema | Runs complete constraints for a schema whose underlying primitive value is text. |
| ordered | SchemaCheck.ordered schema | Runs complete constraints for a schema whose underlying primitive has the supplied ordered type. |
Adapts a check over a schema's underlying primitive representation into a check over the schema's values.
Parameters
| Name | Type | Description |
|---|---|---|
| constraint' | Constraint<'primitive> | |
| schema | Schema<'value> |
Returns
'value -> Result<unit, Violation>
Verification Examples
let emailSchema = Schema.text |> Schema.constrain Constraint.email
let checkEmail = SchemaCheck.fromUnderlying Constraint.email emailSchemaRuns each complete constraint against the value at the refinement layer where it was attached.
Parameters
| Name | Type | Description |
|---|---|---|
| schema | Schema<'value> |
Returns
'value -> Result<unit, Violation>
Verification Examples
let constrainedNameSchema = Schema.text |> Schema.constrain Constraint.present
let checkName = SchemaCheck.complete constrainedNameSchemaRuns complete constraints for a schema whose underlying primitive value is text.
Parameters
| Name | Type | Description |
|---|---|---|
| schema | Schema<'value> |
Returns
'value -> Result<unit, Violation>
Verification Examples
let emailSchema = Schema.text |> Schema.constrain Constraint.email
let checkEmail = SchemaCheck.text emailSchema