SchemaCheckModule

PackageReified.Schema
Functions for running executable value checks against refined and primitive value schemas.

Summary

NameSignatureSynopsis
fromUnderlyingSchemaCheck.fromUnderlying constraint' schemaAdapts a check over a schema's underlying primitive representation into a check over the schema's values.
completeSchemaCheck.complete schemaRuns each complete constraint against the value at the refinement layer where it was attached.
textSchemaCheck.text schemaRuns complete constraints for a schema whose underlying primitive value is text.
orderedSchemaCheck.ordered schemaRuns complete constraints for a schema whose underlying primitive has the supplied ordered type.

fromUnderlying

SchemaCheck.fromUnderlying constraint' schema
Member
Adapts a check over a schema's underlying primitive representation into a check over the schema's values.

Parameters

NameTypeDescription
constraint'Constraint<'primitive>
schemaSchema<'value>

Returns

'value -> Result<unit, Violation>

Verification Examples

let emailSchema = Schema.text |> Schema.constrain Constraint.email
 let checkEmail = SchemaCheck.fromUnderlying Constraint.email emailSchema

complete

SchemaCheck.complete schema
Member
Runs each complete constraint against the value at the refinement layer where it was attached.

Parameters

NameTypeDescription
schemaSchema<'value>

Returns

'value -> Result<unit, Violation>

Verification Examples

let constrainedNameSchema = Schema.text |> Schema.constrain Constraint.present
 let checkName = SchemaCheck.complete constrainedNameSchema

text

SchemaCheck.text schema
Member
Runs complete constraints for a schema whose underlying primitive value is text.

Parameters

NameTypeDescription
schemaSchema<'value>

Returns

'value -> Result<unit, Violation>

Verification Examples

let emailSchema = Schema.text |> Schema.constrain Constraint.email
 let checkEmail = SchemaCheck.text emailSchema

ordered

SchemaCheck.ordered schema
Member
Runs complete constraints for a schema whose underlying primitive has the supplied ordered type.

Parameters

NameTypeDescription
schemaSchema<'value>

Returns

'value -> Result<unit, Violation>

Verification Examples

let checkAge = SchemaCheck.ordered<int, int> ageSchema