https://github.com/ingitdb/ingitdb-schema
Defines IngitDB definition schema
https://github.com/ingitdb/ingitdb-schema
ingitdb json-schema
Last synced: about 2 months ago
JSON representation
Defines IngitDB definition schema
- Host: GitHub
- URL: https://github.com/ingitdb/ingitdb-schema
- Owner: ingitdb
- License: mit
- Created: 2021-09-13T23:19:25.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-04-05T01:42:55.000Z (about 1 year ago)
- Last Synced: 2025-06-05T14:04:20.360Z (about 1 year ago)
- Topics: ingitdb, json-schema
- Language: TypeScript
- Homepage: https://ingitdb.com
- Size: 10.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# inGitDB JSON Schemas
This directory contains [JSON Schema](https://json-schema.org/) definitions for **inGitDB** configuration and collection definition files.
## Schemas
### `ingitdb-root-config.schema.json`
Schema for the **`.ingitdb.yaml`** root configuration file. This file lives at the root of an inGitDB database repository and maps collection IDs to their directory paths.
**Key properties:**
| Property | Type | Description |
| ----------------- | ------------------- | ----------------------------------------------------------------------------------------------- |
| `rootCollections` | `map[string]string` | Maps collection IDs to relative directory paths. A trailing `*` auto-discovers sub-collections. |
### `ingitdb-collection.schema.json`
Schema for **`.ingitdb-collection.yaml`** files. Each collection directory contains one of these files to define its structure.
**Top-level properties:**
| Property | Type | Required | Description |
| --------------- | ---------------------- | -------- | ----------------------------------------------------- |
| `titles` | `map[string]string` | No | Localized collection titles keyed by locale code. |
| `record_file` | `RecordFileDef` | **Yes** | Defines file naming, format, and record storage type. |
| `data_dir` | `string` | No | Relative path to the data files directory. |
| `columns` | `map[string]ColumnDef` | **Yes** | Column definitions (at least one required). |
| `columns_order` | `string[]` | No | Display order of columns (unique, no duplicates). |
| `default_view` | `string` | No | ID of the default view. |
**`RecordFileDef`** — defines how records are stored:
| Property | Type | Required | Description |
| -------- | -------- | -------- | ------------------------------------------------------------------- |
| `name` | `string` | **Yes** | File name pattern (supports `{key}` and column placeholders). |
| `format` | `string` | **Yes** | Serialization format (e.g. `JSON`, `YAML`). |
| `type` | `enum` | **Yes** | `map[string]any` · `[]map[string]any` · `map[string]map[string]any` |
**`ColumnDef`** — defines a column in the collection:
| Property | Type | Required | Description |
| ------------- | ------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `type` | `string` / `enum` | **Yes** | Data type: `string`, `int`, `float`, `bool`, `date`, `time`, `datetime`, `any`, `map[locale]string`, or `map[keyType]valueType`. |
| `title` | `string` | No | Single-locale display title. |
| `titles` | `map[string]string` | No | Localized titles keyed by locale. |
| `valueTitle` | `string` | No | Display title for the column value. |
| `required` | `boolean` | No | Whether a value is required (default: `false`). |
| `length` | `integer` | No | Exact required length. |
| `min_length` | `integer` | No | Minimum length. |
| `max_length` | `integer` | No | Maximum length. |
| `foreign_key` | `string` | No | Reference to another collection (e.g. `auth.users`). |
## Usage
Reference the schemas in your YAML files for IDE validation and autocompletion:
```yaml
# yaml-language-server: $schema=./schemas/ingitdb-collection.schema.json
```
## Source of Truth
These schemas are derived from the Go struct definitions in [`ingitdb-go/ingitdb/`](../../ingitdb-go/ingitdb/):
- [`definition.go`](../../ingitdb-go/ingitdb/definition.go) — `Definition`
- [`collection_def.go`](../../ingitdb-go/ingitdb/collection_def.go) — `CollectionDef`
- [`record_file_def.go`](../../ingitdb-go/ingitdb/record_file_def.go) — `RecordFileDef`
- [`column_def.go`](../../ingitdb-go/ingitdb/column_def.go) — `ColumnDef`
- [`column_type.go`](../../ingitdb-go/ingitdb/column_type.go) — `ColumnType`
- [`config/root_config.go`](../../ingitdb-go/ingitdb/config/root_config.go) — `RootConfig`