Type Alias: LixSchemaDefinition

LixSchemaDefinition = JSONSchema & object

LixSchema

A superset of JSON Schema (draft-07) that includes Lix-specific metadata and supports custom extensions.

Custom extensions may be added with any x-* prefix.

Type declaration

properties?

optional properties: object

Index Signature

[key: string]: LixPropertySchema

type

type: "object"

x-lix-foreign-keys?

optional x-lix-foreign-keys: object

Foreign key constraints referencing other schemas.

Index Signature

[localProperty: string]: object

Example

{
	 *     "x-lix-foreign-keys": {
	 *       "author_id": {
	 *         "schemaKey": "user_profile",
	 *         "property": "id"
	 *       },
	 *       "category_id": {
	 *         "schemaKey": "post_category",
	 *         "property": "id"
	 *       }
	 *     }
	 *   }

x-lix-key

x-lix-key: string

The key of the schema.

The key is used to identify the schema. You must use a unique key for each schema.

Example

"csv_plugin_cell"

x-lix-primary-key?

optional x-lix-primary-key: string[] | readonly string[]

x-lix-unique?

optional x-lix-unique: string[][] | readonly readonly string[][]

Properties that must be unique per version.

Not to be confused by x-version which is used for versioning the schema.

Example

{
	 *     "x-lix-unique": [
	 *       // the id must be unique
	 *       ["id"],
	 *       // the name and age must be unique as well
	 *       ["name", "age"],
	 *     ],
	 *     properties: {
	 *       id: { type: "string" },
	 *       name: { type: "string" },
	 *       age: { type: "number" },
	 *     },
	 *   }

x-lix-version

x-lix-version: string

The version of the schema.

Use the major version to signal breaking changes. Use the minor version to signal non-breaking changes.

Example

"1.0"