SchemaPathModule

PackageReified.Schema
Functions for building and formatting schema error paths.

Summary

NameSignatureSynopsis
rootSchemaPath.root The root of a schema value.
keySchemaPath.key valueA string field or map-key location.
indexSchemaPath.index valueA zero-based collection-item location.
appendSchemaPath.append parent childAppends a relative path to a parent path.
formatSchemaPath.format pathFormats a path with dot-separated keys and bracketed indexes.
foldSchemaPath.fold keyFolder indexFolder state pathFolds over string keys and integer indexes without exposing a path-segment type.

root

SchemaPath.root
Member
The root of a schema value.

Returns

SchemaPath

key

SchemaPath.key value
Member
A string field or map-key location.

Parameters

NameTypeDescription
valuestring

Returns

SchemaPath

index

SchemaPath.index value
Member
A zero-based collection-item location.

Parameters

NameTypeDescription
valueint

Returns

SchemaPath

append

SchemaPath.append parent child
Member
Appends a relative path to a parent path.

Parameters

NameTypeDescription
parentSchemaPath
childSchemaPath

Returns

SchemaPath

format

SchemaPath.format path
Member
Formats a path with dot-separated keys and bracketed indexes.

Parameters

NameTypeDescription
pathSchemaPath

Returns

string

fold

SchemaPath.fold keyFolder indexFolder state path
Member
Folds over string keys and integer indexes without exposing a path-segment type.

Parameters

NameTypeDescription
keyFolder'a -> string -> 'a
indexFolder'a -> int -> 'a
state'a
pathSchemaPath

Returns

'a