From 8f342ea2d392779e8236c5bdc07e6938d6888e14 Mon Sep 17 00:00:00 2001 From: Lars Date: Tue, 9 Sep 2025 16:15:05 +0200 Subject: [PATCH] schemas/chunk.schema.json aktualisiert --- schemas/chunk.schema.json | 106 ++++++++++++++++++++++++++++---------- 1 file changed, 79 insertions(+), 27 deletions(-) diff --git a/schemas/chunk.schema.json b/schemas/chunk.schema.json index 0c49b10..e992971 100644 --- a/schemas/chunk.schema.json +++ b/schemas/chunk.schema.json @@ -2,37 +2,89 @@ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "mindnet_chunk", "type": "object", - "required": ["id", "note_id", "chunk_index", "type", "path", "token_count", "lang"], + "description": "Chunk-Payload (Qdrant). Kompatibel mit Alt-Feldern und neuen Feldern für Export/Roundtrip.", + "required": ["id", "note_id", "chunk_index", "path"], "properties": { - "id": {"type": "string"}, - "note_id": {"type": "string"}, - "note_title": {"type": "string"}, - "chunk_index": {"type": "integer"}, - "char_start": {"type": "integer"}, - "char_end": {"type": "integer"}, - "token_count": {"type": "integer"}, - "type": {"type": "string"}, - "area": {"type": "string"}, - "project": {"type": "string"}, - "tags": {"type": "array", "items": {"type": "string"}}, - "section_title": {"type": "string"}, - "section_path": {"type": "string"}, - "lang": {"type": "string"}, - "wikilinks": {"type": "array", "items": {"type": "string"}}, - "external_links": {"type": "array", "items": {"type": "string"}}, + "id": { "type": "string" }, + "scope": { "type": "string", "enum": ["chunk"] }, + "note_id": { "type": "string" }, + "note_title": { "type": "string" }, + "note_type": { "type": "string" }, + "note_status": { "type": "string" }, + "type": { "type": "string", "description": "Legacy: früherer Chunk-Typ; kann dem Note-Typ entsprechen" }, + "area": { "type": "string" }, + "project": { "type": "string" }, + "tags": { "type": "array", "items": { "type": "string" } }, + + "note_path": { "type": "string" }, + "path": { "type": "string" }, + + "chunk_index": { "type": "integer" }, + "section_title":{ "type": ["string","null"] }, + "section_path": { "type": ["string","null"] }, + + "char_start": { "type": ["integer","null"] }, + "char_end": { "type": ["integer","null"] }, + "char_len": { "type": "integer" }, + + "token_count": { "type": "integer", "description": "Legacy: frühere Token-Zahl" }, + "token_est": { "type": "integer", "description": "Neue grobe Token-Schätzung (≈ len(text)/4)" }, + + "neighbors": { + "type": "object", + "properties": { + "prev": { "type": ["string","null"] }, + "next": { "type": ["string","null"] } + }, + "additionalProperties": false + }, + + "text": { "type": "string" }, + "text_sha256": { "type": "string", "pattern": "^sha256:[0-9a-fA-F]{64}$" }, + "lang": { "type": "string" }, + + "wikilinks": { "type": "array", "items": { "type": "string" } }, + "external_links": { + "type": "array", + "items": { + "anyOf": [ + { "type": "string" }, + { + "type": "object", + "properties": { + "href": { "type": "string" }, + "label": { "type": ["string","null"] } + }, + "required": ["href"], + "additionalProperties": false + } + ] + } + }, "references": { "type": "array", - "items": {"type": "object", "properties": { - "target_id": {"type": "string"}, - "kind": {"type": "string"} - }, "required": ["target_id", "kind"]} + "items": { + "type": "object", + "properties": { + "target_id": { "type": "string" }, + "kind": { "type": "string" } + }, + "required": ["target_id","kind"], + "additionalProperties": true + } }, - "neighbors": {"type": "object", "properties": { - "prev": {"type": ["string","null"]}, - "next": {"type": ["string","null"]} - }}, - "path": {"type": "string"}, - "created_at": {"type": "string"} + + "embed_model": { "type": "string" }, + "embed_dim": { "type": "integer" }, + "embed_version": { "type": "integer" }, + + "created_at": { "type": "string" } }, + + "allOf": [ + { "anyOf": [ { "required": ["token_count"] }, { "required": ["token_est"] } ] }, + { "anyOf": [ { "required": ["type"] }, { "required": ["note_type"] } ] } + ], + "additionalProperties": true }