CLI: Schema files
Commands to pull a space’s schema as a .hako.json file, view the diff, and apply it to another space, plus a command to pull type definitions. Common flags that you can add to any command (--host, --json, and others) are in the CLI command reference.
For how to use them, see Apply a schema from CI.
| Command | Description |
|---|---|
hakocms-cli schema apply |
Apply a schema file to a space |
hakocms-cli schema diff |
Show the diff between a schema file and the space’s current schema (changes nothing) |
hakocms-cli schema pull |
Pull a space’s schema into a schema file (.hako.json) |
hakocms-cli schema types |
Write out entry types (TypeScript), a GraphQL schema, or OpenAPI for the public API |
hakocms-cli schema apply
Section titled “hakocms-cli schema apply”Apply a schema file to a space.
Shows the diff, asks for confirmation, applies it, and waits until it finishes. When running from CI, use –force. Changes that existing entries do not satisfy require –allow-violations, and deleting content types that are not in the file requires –prune.
hakocms-cli schema apply [OPTIONS] <FILE>| Flag or argument | Description |
|---|---|
<FILE> |
Schema file (- for standard input) |
-s, --space <SLUG> |
Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order |
--allow-violations |
Apply changes even if existing entries violate them |
--prune |
Delete content types that are not in the file, together with their entries |
--force |
Apply without asking for confirmation |
hakocms-cli schema diff
Section titled “hakocms-cli schema diff”Show the diff between a schema file and the space’s current schema (changes nothing)
hakocms-cli schema diff [OPTIONS] <FILE>| Flag or argument | Description |
|---|---|
<FILE> |
Schema file (- for standard input) |
-s, --space <SLUG> |
Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order |
hakocms-cli schema pull
Section titled “hakocms-cli schema pull”Pull a space’s schema into a schema file (.hako.json).
Downloads a schema file (*.hako.json).
Returns the current schema in a form you can pass as-is to a schema apply (schema apply).
hakocms-cli schema pull [OPTIONS]| Flag or argument | Description |
|---|---|
-s, --space <SLUG> |
Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order |
-o, --output <PATH> |
Where to write (- for standard output). If omitted, |
--force |
Overwrite the file if it exists |
hakocms-cli schema types
Section titled “hakocms-cli schema types”Write out entry types (TypeScript), a GraphQL schema, or OpenAPI for the public API.
hakocms-cli schema types [OPTIONS]| Flag or argument | Description |
|---|---|
-s, --space <SLUG> |
Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order |
--format <FORMAT> |
Format (default typescript) |
-o, --output <PATH> |
Where to write (- for standard output). If omitted, standard output |
--force |
Overwrite the file if it exists |