|
| 1 | +{ |
| 2 | + "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 3 | + "$id": "https://bearsunday.github.io/BEAR.QueryRepository/schemas/repository-log.json", |
| 4 | + "title": "BEAR.QueryRepository Log Entry", |
| 5 | + "description": "JSON log entry format for BEAR.QueryRepository operations", |
| 6 | + "type": "object", |
| 7 | + "required": ["op"], |
| 8 | + "properties": { |
| 9 | + "op": { |
| 10 | + "type": "string", |
| 11 | + "description": "Operation name", |
| 12 | + "enum": [ |
| 13 | + "save-value", |
| 14 | + "save-view", |
| 15 | + "save-etag", |
| 16 | + "save-donut", |
| 17 | + "save-donut-view", |
| 18 | + "invalidate-etag", |
| 19 | + "put-query-repository", |
| 20 | + "purge-query-repository", |
| 21 | + "put-donut", |
| 22 | + "try-donut-view", |
| 23 | + "found-donut-view", |
| 24 | + "try-donut", |
| 25 | + "no-donut-found", |
| 26 | + "refresh-donut" |
| 27 | + ] |
| 28 | + }, |
| 29 | + "uri": { |
| 30 | + "type": "string", |
| 31 | + "description": "Resource URI (e.g., page://self/user, app://self/posts)", |
| 32 | + "pattern": "^(page|app)://self/.+" |
| 33 | + }, |
| 34 | + "tags": { |
| 35 | + "type": "array", |
| 36 | + "description": "Cache tags for invalidation", |
| 37 | + "items": { |
| 38 | + "type": "string" |
| 39 | + } |
| 40 | + }, |
| 41 | + "surrogateKeys": { |
| 42 | + "type": "array", |
| 43 | + "description": "Surrogate keys for CDN cache invalidation", |
| 44 | + "items": { |
| 45 | + "type": "string" |
| 46 | + } |
| 47 | + }, |
| 48 | + "etag": { |
| 49 | + "type": "string", |
| 50 | + "description": "Entity tag for cache validation" |
| 51 | + }, |
| 52 | + "ttl": { |
| 53 | + "type": ["integer", "null"], |
| 54 | + "description": "Time to live in seconds", |
| 55 | + "minimum": 0 |
| 56 | + }, |
| 57 | + "sMaxAge": { |
| 58 | + "type": ["integer", "null"], |
| 59 | + "description": "Shared cache max age in seconds (for CDN)", |
| 60 | + "minimum": 0 |
| 61 | + } |
| 62 | + }, |
| 63 | + "allOf": [ |
| 64 | + { |
| 65 | + "if": { |
| 66 | + "properties": { "op": { "const": "save-value" } } |
| 67 | + }, |
| 68 | + "then": { |
| 69 | + "required": ["uri", "tags", "ttl"] |
| 70 | + } |
| 71 | + }, |
| 72 | + { |
| 73 | + "if": { |
| 74 | + "properties": { "op": { "const": "save-view" } } |
| 75 | + }, |
| 76 | + "then": { |
| 77 | + "required": ["uri", "ttl"] |
| 78 | + } |
| 79 | + }, |
| 80 | + { |
| 81 | + "if": { |
| 82 | + "properties": { "op": { "const": "save-etag" } } |
| 83 | + }, |
| 84 | + "then": { |
| 85 | + "required": ["uri", "etag", "surrogateKeys"] |
| 86 | + } |
| 87 | + }, |
| 88 | + { |
| 89 | + "if": { |
| 90 | + "properties": { "op": { "const": "save-donut" } } |
| 91 | + }, |
| 92 | + "then": { |
| 93 | + "required": ["uri", "sMaxAge"] |
| 94 | + } |
| 95 | + }, |
| 96 | + { |
| 97 | + "if": { |
| 98 | + "properties": { "op": { "const": "save-donut-view" } } |
| 99 | + }, |
| 100 | + "then": { |
| 101 | + "required": ["uri", "surrogateKeys", "sMaxAge"] |
| 102 | + } |
| 103 | + }, |
| 104 | + { |
| 105 | + "if": { |
| 106 | + "properties": { "op": { "const": "invalidate-etag" } } |
| 107 | + }, |
| 108 | + "then": { |
| 109 | + "required": ["tags"] |
| 110 | + } |
| 111 | + }, |
| 112 | + { |
| 113 | + "if": { |
| 114 | + "properties": { "op": { "const": "put-donut" } } |
| 115 | + }, |
| 116 | + "then": { |
| 117 | + "required": ["uri", "ttl"] |
| 118 | + } |
| 119 | + } |
| 120 | + ], |
| 121 | + "examples": [ |
| 122 | + { |
| 123 | + "op": "save-value", |
| 124 | + "uri": "page://self/user", |
| 125 | + "tags": ["etag123", "_user_"], |
| 126 | + "ttl": 3600 |
| 127 | + }, |
| 128 | + { |
| 129 | + "op": "save-etag", |
| 130 | + "uri": "page://self/user", |
| 131 | + "etag": "etag123", |
| 132 | + "surrogateKeys": ["_user_", "user-tag"] |
| 133 | + }, |
| 134 | + { |
| 135 | + "op": "invalidate-etag", |
| 136 | + "tags": ["_user_"] |
| 137 | + }, |
| 138 | + { |
| 139 | + "op": "put-query-repository", |
| 140 | + "uri": "app://self/posts" |
| 141 | + }, |
| 142 | + { |
| 143 | + "op": "try-donut-view", |
| 144 | + "uri": "page://self/blog" |
| 145 | + }, |
| 146 | + { |
| 147 | + "op": "put-donut", |
| 148 | + "uri": "page://self/blog", |
| 149 | + "ttl": 600, |
| 150 | + "sMaxAge": 3600 |
| 151 | + } |
| 152 | + ] |
| 153 | +} |
0 commit comments