LixSchemaDefinition =
JSONSchema& {additionalProperties:false;properties?: {[key:string]:LixPropertySchema; };type:"object";x-lix-entity-views?: ("state"|"state_by_version"|"state_history")[] | readonly ("state"|"state_by_version"|"state_history")[];x-lix-foreign-keys?:LixForeignKey[] | readonlyLixForeignKey[];x-lix-immutable?:boolean;x-lix-key:string;x-lix-override-lixcols?:Record<string,string>;x-lix-primary-key?:JsonPointer[] | readonlyJsonPointer[];x-lix-unique?:JsonPointer[][] | readonly readonlyJsonPointer[][];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.
additionalProperties:
false
Has to be false to know the schema beforehand.
optionalproperties: {[key:string]:LixPropertySchema; }
[key: string]: LixPropertySchema
type:
"object"
optionalx-lix-entity-views: ("state"|"state_by_version"|"state_history")[] | readonly ("state"|"state_by_version"|"state_history")[]
Restricts which entity views are generated. When omitted, all default variants (state, state_by_version, state_history) are emitted.
{
* "x-lix-entity-views": ["state"] // only generate the base view
* }
optionalx-lix-foreign-keys:LixForeignKey[] | readonlyLixForeignKey[]
Foreign key constraints referencing other schemas.
[
{
"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"]
}
}
]
optionalx-lix-immutable:boolean
Marks the schema as immutable. Immutable entities may be inserted but cannot be updated.
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.
"csv_plugin_cell"
optionalx-lix-override-lixcols:Record<string,string>
Override metadata column values applied by entity-view rewrites (e.g. lixcol_file_id).
Does not provide defaults for JSON properties inside properties. Each entry is a CEL
expression evaluated in the same context as property defaults.
{
* "x-lix-override-lixcols": {
* "lixcol_file_id": "\"lix\"",
* "lixcol_untracked": "0"
* }
* }
optionalx-lix-primary-key:JsonPointer[] | readonlyJsonPointer[]
optionalx-lix-unique:JsonPointer[][] | readonly readonlyJsonPointer[][]
Properties that must be unique per version.
Not to be confused by x-version which is used for versioning the schema.
{
* "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:
string
The version of the schema.
Use the major version to signal breaking changes. Use the minor version to signal non-breaking changes.
"1.0"