Schema validation library for Archetypes.
To install the library, use pnpm
:
pnpm install typematter/schema
NPM packages coming soon!
import schema from 'typematter/schema';
schema.valid([1, 2, 3], { type: 'Array', items: { type: 'Number' } }); // true
Validates a value against a schema.
value: any
: The value to validate.schema: Schema
: The schema to validate against.
boolean
:true
if the value is valid,false
otherwise.
Validates a value against a schema and returns detailed information about the validation.
value: any
: The value to validate.schema: Schema
: The schema to validate against.
ValidationResult
: An object containing detailed information about the validation.
Contributions are welcome! Please read the contributing guidelines first.
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or suggestions, feel free to open an issue.