# `alta schemas`

> alta schemas: writes the JSON Schemas (default docs/standards/schemas/).

Writes the JSON Schemas (default docs/standards/schemas/).

## Usage

```text
alta schemas [--out <dir>] [--check]
```

## Options

| Name | Type | Default | Description |
|---|---|---|---|
| `--out` | *string* | *Default: docs/standards/schemas/* | Where to write the schemas. |
| `--check` | *flag* |  | Write nothing; exit 1 if a schema on disk is out of date. |

## Exit codes

| Name | Description |
|---|---|
| `0` | ok |
| `1` | problems found |
| `2` | bad usage |
| `3` | not in this version |

## Examples

*Write the schemas for your editor*

```sh [Terminal]
alta schemas --out schemas
```

```text [Output]
wrote 10 schemas to schemas
```

**TypeScript SDK:**

*The same from TypeScript, with `schemas` from `@altasystem/sdk`; run it with `node example.mjs`.*

```js [example.mjs]
// The JSON Schema of a document, and its problems against it (what an editor underlines).
import { schemaFields, schemaFor, validateSchema } from "@altasystem/sdk";

const schema = schemaFor("alta.quests/0.3");
console.log(schema.$id);
console.log(schemaFields(schema).length > 50);
console.log(validateSchema(schema, { schema: "alta.quests/0.3", id: "my-pack", branch: "core", quests: "none" }));
```

```text [Output]
alta.quests.schema.json
true
[ 'quests: must be array' ]
```

## See also

- [Autocomplete in your editor](https://docs.altasystem.ai/recipes/editor-schemas)
- [`schemas` (SDK)](https://docs.altasystem.ai/reference/sdk/schemas)
