Files
tibi-types/schemas/config/collection.schema.json
apairon 40b441df04 feat: add new JSON schemas for Tibi configuration including fields, hooks, jobs, and permissions
- Introduced `field-list.schema.json`, `field-meta.schema.json`, and `field.schema.json` for field configurations.
- Added `hooks.schema.json` for defining hooks in the Tibi project.
- Created `image-filter.schema.json` for image processing configurations.
- Implemented `job.schema.json` for job scheduling configurations.
- Added `openapi.schema.json` for OpenAPI metadata generation.
- Introduced `permissions.schema.json` for managing permissions in the project.
- Created `project.schema.json` for overall project configuration.
- Added `projections.schema.json` for defining projections in the project.
- Implemented a validation script `validate-schemas.mjs` to ensure schema compliance.
2026-07-01 09:23:43 +00:00

431 lines
9.1 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "collection.schema.json",
"title": "Tibi collection config",
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^x-": {}
},
"properties": {
"name": {
"type": "string"
},
"defaultLanguage": {
"type": "string"
},
"uploadPath": {
"type": "string"
},
"upload": {
"$ref": "collection.schema.json#/definitions/uploadConfig"
},
"permissions": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "permissions.schema.json"
}
]
},
"projections": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "projections.schema.json"
}
]
},
"hooks": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "hooks.schema.json"
}
]
},
"meta": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "collection-meta.schema.json"
}
]
},
"imageFilter": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "image-filter.schema.json"
}
]
},
"fields": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "field-list.schema.json"
}
]
},
"indexes": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "collection.schema.json#/definitions/indexConfig"
}
]
}
}
]
},
"audit": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean"
},
"actions": {
"type": "array",
"items": {
"type": "string",
"enum": [
"create",
"update",
"delete",
"bulkCreate",
"bulkUpdate",
"bulkDelete"
]
}
}
}
},
"bulk": {
"type": "object",
"additionalProperties": false,
"properties": {
"optimize": {
"type": "object",
"additionalProperties": false,
"properties": {
"create": {
"type": "boolean"
},
"update": {
"type": "boolean"
},
"delete": {
"type": "boolean"
}
}
}
}
},
"queryLimits": {
"type": "object",
"additionalProperties": false,
"properties": {
"defaultLimit": {
"type": "integer",
"minimum": 0
},
"maxLimit": {
"type": "integer",
"minimum": 0
}
}
},
"readonlyFields": {
"type": "array",
"items": {
"$ref": "defs.schema.json#/definitions/fieldPath"
}
},
"hiddenFields": {
"type": "array",
"items": {
"$ref": "defs.schema.json#/definitions/fieldPath"
}
},
"strictFields": {
"type": "boolean"
},
"search": {
"type": "array",
"items": {
"$ref": "collection.schema.json#/definitions/searchConfig"
}
}
},
"required": [
"name",
"permissions"
],
"definitions": {
"uploadConfig": {
"type": "object",
"additionalProperties": false,
"properties": {
"maxBodySize": {
"type": "string"
},
"allowedMimeTypes": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"indexConfig": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"key": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
}
},
"unique": {
"type": "boolean"
},
"dropDups": {
"type": "boolean"
},
"background": {
"type": "boolean"
},
"sparse": {
"type": "boolean"
},
"defaultLanguage": {
"type": "string"
},
"languageOverride": {
"type": "string"
}
},
"required": [
"key"
]
},
"searchConfig": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"mode": {
"type": "string",
"enum": [
"text",
"regex",
"eval",
"filter",
"ngram",
"vector",
"combined"
]
},
"fields": {
"type": "array",
"items": {
"$ref": "defs.schema.json#/definitions/fieldPath"
}
},
"meta": {
"type": "object",
"additionalProperties": true
},
"eval": {
"type": "string"
},
"filter": {
"type": "object",
"additionalProperties": true
},
"ngram": {
"type": "object",
"additionalProperties": false,
"properties": {
"sizes": {
"type": "array",
"items": {
"type": "integer",
"minimum": 1
}
},
"normalize": {
"type": "object",
"additionalProperties": false,
"properties": {
"use": {
"type": "array",
"items": {
"type": "string"
}
},
"eval": {
"type": "string"
}
}
}
}
},
"regex": {
"type": "object",
"additionalProperties": false,
"properties": {
"weights": {
"type": "object",
"additionalProperties": {
"type": "number"
}
},
"scoring": {
"type": "string",
"enum": [
"count",
"binary",
"log"
]
}
}
},
"score": {
"type": "object",
"additionalProperties": false,
"properties": {
"expr": {
"type": "object",
"additionalProperties": true
}
}
},
"vector": {
"type": "object",
"additionalProperties": false,
"properties": {
"provider": {
"type": "string"
},
"documentPrefix": {
"type": "string"
},
"queryPrefix": {
"type": "string"
},
"overflow": {
"type": "string",
"enum": [
"truncate",
"chunk"
]
},
"chunkSize": {
"type": "integer",
"minimum": 1
},
"chunkOverlap": {
"type": "integer",
"minimum": 0
}
},
"required": [
"provider"
]
},
"rrf": {
"type": "object",
"additionalProperties": false,
"properties": {
"k": {
"type": "integer",
"minimum": 1
},
"topK": {
"type": "integer",
"minimum": 1
},
"weights": {
"type": "object",
"additionalProperties": {
"type": "number"
}
},
"strategy": {
"type": "string",
"enum": ["rrf", "score_rrf", "score_sum", "rank_score", "hybrid"]
},
"normalize": {
"type": "string",
"enum": ["none", "minmax", "zscore"]
},
"scoreWeight": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"sourceConfig": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"scoreWeight": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"boost": {
"type": "number",
"minimum": 0
}
}
}
}
}
},
"async": {
"type": "boolean"
},
"autoRegenerate": {
"type": "boolean"
}
},
"required": [
"name",
"mode"
]
}
}
}