@ayte/archetype.validation
v0.2.0
Published
Basic types related to validation process, part of @ayte/archetype
Readme
Ayte / TypeScript / Archetype / Validation
This package contains types related to validation process. This package is in incubatory stage and thus may significantly change it's API in future releases.
Installation
yarn add @ayte/archetype.validation
# - or -
npm install -S @ayte/archetype.validationStructure
At this moment this library only defines validator (IValidator) and
violation (IViolation) types.
It is implied that violation consists of message, validated value,
validation root, path from root to value and arbitrary metadata. For
example, if one validates {"text": 12}, then violation may have this
object as root, ["text"] as path, 12 as validated value and
not a text as message.
Validator is just a function that takes in value and returns list of violations.
Licensing
MIT / UPL-1.0
Ayte Labs, 2020
