Modules@robinpath/schema

@robinpath/schema

0.1.0Public

Lightweight schema validation: validate data against type schemas with constraints

@robinpath/schema

Lightweight schema validation: validate data against type schemas with constraints

Category Functions Auth License

Why use this module?

The schema module lets you:

  • Validate data against a schema
  • Check if data matches schema (boolean)
  • Create a string schema
  • Create a number schema
  • Create a boolean schema

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/schema

Quick Start

No credentials needed — start using it right away:

schema.isValid $data $schema

Available Functions

FunctionDescription
schema.validateValidate data against a schema
schema.isValidCheck if data matches schema (boolean)
schema.stringCreate a string schema
schema.numberCreate a number schema
schema.booleanCreate a boolean schema
schema.arrayCreate an array schema
schema.objectCreate an object schema
schema.nullableMake a schema also accept null
schema.oneOfCreate a schema matching one of several schemas
schema.getErrorsValidate and return only the errors array

Examples

Check if data matches schema (boolean)

schema.isValid $data $schema

Create a string schema

schema.string {"minLength": 1}

Create a number schema

schema.number {"min": 0, "max": 100}

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/schema";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  schema.isValid $data $schema
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.0latestyesterday
Install
$ robinpath install @robinpath/schema
Version0.1.0
LicenseMIT
Unpacked Size4.5 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

utilities