# @toa.io/schemas

> Toa Schemas

Latest version **0.24.0-alpha.0** (published 2023-11-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @toa.io/schemas
pnpm add @toa.io/schemas
yarn add @toa.io/schemas
bun add @toa.io/schemas
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.24.0-alpha.0 |
| Published | 2023-11-16 |
| First published | 2023-03-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 18.0.0 |
| Dependencies | 7 |
| Unpacked size | 14.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Artem Gurtovoi |
| Maintainers | agurtovoi |

## Links

- npm: https://www.npmjs.com/package/@toa.io/schemas
- Repository: https://github.com/toa-io/toa
- Homepage: https://toa.io
- Issues: https://github.com/toa-io/toa/issues
- npm.io page: https://npm.io/package/@toa.io/schemas

## Dependencies (7)

- [ajv](https://npm.io/package/ajv.md) 8.12.0
- [ajv-formats](https://npm.io/package/ajv-formats.md) 2.1.1
- [@toa.io/yaml](https://npm.io/package/@toa.io/yaml.md) 0.24.0-alpha.0
- [@toa.io/concise](https://npm.io/package/@toa.io/concise.md) 0.24.0-alpha.0
- [@toa.io/generic](https://npm.io/package/@toa.io/generic.md) 0.24.0-alpha.0
- [better-ajv-errors](https://npm.io/package/better-ajv-errors.md) 1.2.0
- [@toa.io/filesystem](https://npm.io/package/@toa.io/filesystem.md) 0.24.0-alpha.0

## Recent versions

- 0.24.0-alpha.0 (latest) — 2023-11-16
- 1.0.0-alpha.332 (alpha) — 2026-10-23
- 0.8.4-alpha.56 (canary) — 2023-05-30
- 0.4.0-dev.9 (dev) — 2023-04-10
- 1.0.0-alpha.330 — 2026-10-15
- 1.0.0-alpha.329 — 2026-10-11
- 1.0.0-alpha.326 — 2026-10-06
- 1.0.0-alpha.311 — 2026-09-17
- 1.0.0-alpha.310 — 2026-09-16
- 1.0.0-alpha.304 — 2026-09-13
- 1.0.0-alpha.301 — 2026-09-11
- 1.0.0-alpha.299 — 2026-09-10
- 1.0.0-alpha.293 — 2026-09-07
- 1.0.0-alpha.292 — 2026-09-07
- 1.0.0-alpha.291 — 2026-09-07
- … 205 more at https://npm.io/package/@toa.io/schemas/versions

## README

# Toa Schema Validator

Takes your [COS](/libraries/concise), transforms it to JSONSchema and feeds it
to [Ajv](https://ajv.js.org).

*Also, slightly transforms validation error objects for no obvious reason.*

## schema(schema: cos): Schema

Factory for [Schema class](./types/schema.d.ts).

### `.fit(value)`

Returns [error](./types/schema.d.ts) if given value doesn't match the schema, `null` otherwise.

## schema(path: string): Schema

Loads schema from a file.

## namespace(schemas: cos[]): Namespace

Factory for [Namespace class](./types/namespace.d.ts).

## namespace(path: string): Namespace

Loads schemas from `.cos.yaml` files within given directory, setting their missing `$id` to the file
relative path and basename and returns `Namespace`.

> "up" schema references (`../`) are not supported.

---
_Source: https://npm.io/package/@toa.io/schemas · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
