Type Alias: LixSchemaDefinition

LixSchemaDefinition = JSONSchema & { properties?: {[key: string]: LixPropertySchema; }; type: "object"; x-lix-foreign-keys?: LixForeignKey[] | readonly LixForeignKey[]; x-lix-key: string; x-lix-primary-key?: string[] | readonly string[]; x-lix-unique?: string[][] | readonly readonly string[][]; x-lix-version: string; }

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: {[key: string]: LixPropertySchema; }

Index Signature

[key: string]: LixPropertySchema

type

type: "object"

x-lix-foreign-keys?

optional x-lix-foreign-keys: LixForeignKey[] | readonly LixForeignKey[]

Foreign key constraints referencing other schemas.

Example

[
    {
      "properties": ["author_id"],
      "references": {
        "schemaKey": "user_profile",
        "properties": ["id"]
      }
    },
    {
      "properties": ["entity_id", "schema_key", "file_id"],
      "references": {
        "schemaKey": "state",
        "properties": ["entity_id", "schema_key", "file_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"