Files
tibi-types/schemas/config/collection.schema.json
T
apairon 9e12a8e9c3
continuous-integration/drone/push Build is passing
Schema: ngram.stopwords, queryFilter und inMemory ergänzen
Der Config-Vertrag kannte nur sizes und normalize. Damit lehnte
`validate:schemas` jedes Projekt ab, das die bereits im Server vorhandenen
ngram-Optionen nutzt (additionalProperties: false), und die generierte
Schema-Referenz konnte sie nie zeigen.

Ergänzt in collection.schema.json und index.d.ts:

- stopwords: { presets?: string[], words?: string[] }
- queryFilter: { minMatchRatio?: 0..1 }
- inMemory: { enabled?, maxDocs?, maxMemoryMB? }

plus demo-api/collections/ngram-stopwords.yml als Validierungs-Fixture; ohne
Schema-Erweiterung schlägt validate:schemas dort mit "must NOT have additional
properties" fehl.
2026-10-19 20:48:10 +00:00

517 lines
11 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"
}
}
}
}
},
"cors": {
"type": "object",
"additionalProperties": false,
"properties": {
"merge": {
"type": "boolean"
},
"allowOrigins": {
"type": "array",
"items": {
"type": "string"
}
},
"allowCredentials": {
"type": "boolean"
},
"allowHeaders": {
"type": "array",
"items": {
"type": "string"
}
},
"allowMethods": {
"type": "array",
"items": {
"type": "string"
}
},
"exposeHeaders": {
"type": "array",
"items": {
"type": "string"
}
},
"maxAge": {
"type": "integer",
"minimum": 0
}
}
},
"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"
}
}
},
"stopwords": {
"type": "object",
"additionalProperties": false,
"properties": {
"presets": {
"type": "array",
"items": {
"type": "string"
}
},
"words": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"queryFilter": {
"type": "object",
"additionalProperties": false,
"properties": {
"minMatchRatio": {
"type": "number",
"minimum": 0,
"maximum": 1
}
}
},
"inMemory": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean"
},
"maxDocs": {
"type": "integer",
"minimum": 0
},
"maxMemoryMB": {
"type": "integer",
"minimum": 0
}
}
}
}
},
"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"
]
}
}
}