|
1 | 1 | # Raid Schema Specifications |
2 | 2 |
|
3 | | -This directory contains JSON Schema definitions for Raid configuration files. |
| 3 | +This directory contains the JSON Schema definitions for Raid configuration files. |
| 4 | +It is the **single source of truth** for the schemas — files here are both: |
4 | 5 |
|
5 | | -## Schema Files |
6 | | - |
7 | | -- `raid-profile.schema.json` - Schema for raid profile configuration files |
8 | | -- `raid-repo.schema.json` - Schema for individual repository configuration files |
9 | | - |
10 | | -## Schema Version |
11 | | - |
12 | | -These schemas follow the **JSON Schema Draft 2020-12** specification and are compatible with the `github.com/santhosh-tekuri/jsonschema/v6` library (v6.0.2). |
| 6 | +1. Embedded into the Go binary via `go:embed` (used at runtime to validate |
| 7 | + profile and repo files), and |
| 8 | +2. Copied into `site/static/schema/v1/` by `site/plugins/copy-schemas.ts` at |
| 9 | + docsite build time, so they are served at the canonical URLs: |
13 | 10 |
|
14 | | -The `$schema` field is properly supported and the library fully validates against the JSON Schema Draft 2020-12 specification. |
| 11 | + - https://raidcli.dev/schema/v1/raid-defs.schema.json |
| 12 | + - https://raidcli.dev/schema/v1/raid-profile.schema.json |
| 13 | + - https://raidcli.dev/schema/v1/raid-repo.schema.json |
15 | 14 |
|
16 | | -## Usage |
17 | | - |
18 | | -The schemas are used to validate YAML and JSON configuration files in the Raid CLI tool. The validation ensures that configuration files have the correct structure and required fields. |
| 15 | +## Schema Files |
19 | 16 |
|
20 | | -### Supported File Formats |
| 17 | +- `raid-defs.schema.json` — Shared `$defs` (task types, environments, |
| 18 | + commands, install). Referenced from the other two schemas. |
| 19 | +- `raid-profile.schema.json` — Profile file schema (`*.raid.yaml`). |
| 20 | +- `raid-repo.schema.json` — Per-repository schema (`raid.yaml`). |
21 | 21 |
|
22 | | -- YAML files (`.yaml`, `.yml`) |
23 | | -- JSON files (`.json`) |
| 22 | +## Versioning |
24 | 23 |
|
25 | | -### Validation |
| 24 | +The `/schema/v1/` path is a **public stability contract**. |
26 | 25 |
|
27 | | -Profile files are validated against `raid-profile.schema.json` when using the `raid profile add` command. The validation checks: |
| 26 | +- Additive changes (new optional fields, new task types, new enum values) are |
| 27 | + allowed within v1. |
| 28 | +- Breaking changes (renaming or removing a field, tightening a `required` list, |
| 29 | + removing an enum value, turning an optional field required) require a new |
| 30 | + major version. Cut a `/schema/v2/` folder by freezing the current v1 files |
| 31 | + alongside the source and evolving the source separately. |
| 32 | +- Bump the second position of `version` in `src/resources/app.properties` when |
| 33 | + publishing a new major schema version. |
28 | 34 |
|
29 | | -- Required fields are present |
30 | | -- Data types are correct |
31 | | -- Structure matches the schema definition |
| 35 | +The `$id` fields are baked as absolute URLs so external validators resolve |
| 36 | +cross-references without depending on the retrieval URL. Internal validation |
| 37 | +(see `src/internal/lib/lib.go`) registers each embedded schema under its `$id` |
| 38 | +and compiles by URL — no network access at runtime. |
32 | 39 |
|
33 | | -## Schema Structure |
| 40 | +## Schema draft |
34 | 41 |
|
35 | | -### Raid Profile Schema |
| 42 | +These schemas follow **JSON Schema Draft 2020-12** and are validated with |
| 43 | +[`github.com/santhosh-tekuri/jsonschema/v6`](https://github.com/santhosh-tekuri/jsonschema) |
| 44 | +(v6.0.2). |
36 | 45 |
|
37 | | -A raid profile configuration must contain: |
| 46 | +## Supported file formats |
38 | 47 |
|
39 | | -- `name` (string, required) - The name of the raid profile |
40 | | -- `repositories` (array, optional) - Array of repository configurations |
41 | | - - Each repository must have: |
42 | | - - `name` (string, required) - The name of the repository |
43 | | - - `path` (string, required) - The local path to the repository |
44 | | - - `url` (string, required) - The URL of the repository |
| 48 | +YAML (`.yaml`, `.yml`) and JSON (`.json`). |
45 | 49 |
|
46 | | -### Raid Repository Schema |
| 50 | +## Usage |
47 | 51 |
|
48 | | -A repository configuration must contain: |
| 52 | +Profile files are validated against `raid-profile.schema.json` by `raid profile |
| 53 | +add` and during config load. Repository `raid.yaml` files are validated against |
| 54 | +`raid-repo.schema.json` when a repo is loaded. |
49 | 55 |
|
50 | | -- `name` (string, required) - The name of the repository |
51 | | -- `branch` (string, required) - The branch to checkout |
| 56 | +Editors that consult [SchemaStore](https://www.schemastore.org/) — VS Code + |
| 57 | +Red Hat YAML, JetBrains, Neovim `yaml-language-server`, Helix — auto-associate |
| 58 | +`*.raid.yaml` and `raid.yaml` with the published schemas, so the `# yaml-language-server` |
| 59 | +modeline is optional. |
0 commit comments