|
| 1 | +{ |
| 2 | + "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 3 | + "$id": "DeclarationContent.schema.json", |
| 4 | + "title": "DeclarationContent", |
| 5 | + "description": "JSON Schema for DeclarationContent<T = undefined>. Because JSON cannot represent functions or promises, we handle them (and TypedNode) via placeholders or string descriptions.", |
| 6 | + "type": "object", |
| 7 | + "properties": { |
| 8 | + "key": { |
| 9 | + "type": "string" |
| 10 | + }, |
| 11 | + "title": { |
| 12 | + "type": "string" |
| 13 | + }, |
| 14 | + "description": { |
| 15 | + "type": "string" |
| 16 | + }, |
| 17 | + "version": { |
| 18 | + "type": "string" |
| 19 | + }, |
| 20 | + "filePath": { |
| 21 | + "type": "string" |
| 22 | + }, |
| 23 | + "tags": { |
| 24 | + "type": "array", |
| 25 | + "items": { |
| 26 | + "type": "string" |
| 27 | + } |
| 28 | + }, |
| 29 | + "content": { |
| 30 | + "type": "object", |
| 31 | + "description": "Represents Record<string, ContentValue | ContentValue[]>", |
| 32 | + "additionalProperties": { |
| 33 | + "anyOf": [ |
| 34 | + { |
| 35 | + "type": "string", |
| 36 | + "description": "Represents a simple string or a placeholder for a function/promise if used that way." |
| 37 | + }, |
| 38 | + { |
| 39 | + "type": "array", |
| 40 | + "description": "Array variant for either string[] or number[] or array of placeholders.", |
| 41 | + "items": { |
| 42 | + "anyOf": [ |
| 43 | + { |
| 44 | + "type": "string", |
| 45 | + "description": "String array item." |
| 46 | + }, |
| 47 | + { |
| 48 | + "type": "number", |
| 49 | + "description": "Number array item." |
| 50 | + }, |
| 51 | + { |
| 52 | + "type": "object", |
| 53 | + "description": "Nested object or typed node within an array.", |
| 54 | + "additionalProperties": { |
| 55 | + "$ref": "#/definitions/contentValue" |
| 56 | + } |
| 57 | + } |
| 58 | + ] |
| 59 | + } |
| 60 | + }, |
| 61 | + { |
| 62 | + "type": "number", |
| 63 | + "description": "Represents a simple numeric value." |
| 64 | + }, |
| 65 | + { |
| 66 | + "type": "object", |
| 67 | + "description": "Represents { [key: string]: ContentValue }, or a nested structure, or a typed node. This is where recursion happens.", |
| 68 | + "additionalProperties": { |
| 69 | + "$ref": "#/definitions/contentValue" |
| 70 | + } |
| 71 | + } |
| 72 | + ] |
| 73 | + } |
| 74 | + } |
| 75 | + }, |
| 76 | + "required": ["key", "content"], |
| 77 | + "additionalProperties": false, |
| 78 | + |
| 79 | + "definitions": { |
| 80 | + "contentValue": { |
| 81 | + "anyOf": [ |
| 82 | + { |
| 83 | + "type": "string", |
| 84 | + "description": "Represents a string or a placeholder for function/promise/TypedNode." |
| 85 | + }, |
| 86 | + { |
| 87 | + "type": "number" |
| 88 | + }, |
| 89 | + { |
| 90 | + "type": "array", |
| 91 | + "items": { |
| 92 | + "anyOf": [ |
| 93 | + { |
| 94 | + "type": "string" |
| 95 | + }, |
| 96 | + { |
| 97 | + "type": "number" |
| 98 | + }, |
| 99 | + { |
| 100 | + "type": "object", |
| 101 | + "additionalProperties": { |
| 102 | + "$ref": "#/definitions/contentValue" |
| 103 | + } |
| 104 | + } |
| 105 | + ] |
| 106 | + } |
| 107 | + }, |
| 108 | + { |
| 109 | + "type": "object", |
| 110 | + "description": "Nested object or typed node structure. Could also be a placeholder for a deeper typed node.", |
| 111 | + "additionalProperties": { |
| 112 | + "$ref": "#/definitions/contentValue" |
| 113 | + } |
| 114 | + } |
| 115 | + ] |
| 116 | + } |
| 117 | + } |
| 118 | +} |
0 commit comments