|
| 1 | +{ |
| 2 | + "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 3 | + "$id": "message.schema.json", |
| 4 | + "type": "object", |
| 5 | + "required": ["id", "channel_type", "user"], |
| 6 | + "properties": { |
| 7 | + "id": { "type": "string", "minLength": 1 }, |
| 8 | + "parent_id": { "type": "string" }, |
| 9 | + "channel_type": { "type": "string" }, |
| 10 | + "channel_id": { "type": "string" }, |
| 11 | + "channel_member_ids": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, |
| 12 | + "text": { "type": "string" }, |
| 13 | + "html": { "type": "string" }, |
| 14 | + "attachments": { "type": "array", "items": { "$ref": "attachment.schema.json" }, "maxItems": 30 }, |
| 15 | + "user": { "type": "string" }, |
| 16 | + "type": { "type": "string", "enum": ["", "regular", "deleted", "system", "reply"], "default": "regular" }, |
| 17 | + "show_in_channel": { "type": "boolean" }, |
| 18 | + "created_at": { "type": "string", "format": "date-time" }, |
| 19 | + "updated_at": { "type": "string", "format": "date-time" }, |
| 20 | + "deleted_at": { "type": "string", "format": "date-time" }, |
| 21 | + "mentioned_users_ids": { "type": "array", "items": { "type": "string" } }, |
| 22 | + "quoted_message_id": { "type": "string" }, |
| 23 | + "pinned_at": { "type": "string", "format": "date-time" }, |
| 24 | + "pinned_by_id": { "type": "string" }, |
| 25 | + "pin_expires": { "type": "string", "format": "date-time" } |
| 26 | + }, |
| 27 | + "anyOf": [ |
| 28 | + { "required": ["channel_id"], "not": { "required": ["channel_member_ids"] } }, |
| 29 | + { "required": ["channel_member_ids"], "not": { "required": ["channel_id"] } } |
| 30 | + ], |
| 31 | + "allOf": [ |
| 32 | + { "if": { "properties": { "type": { "const": "reply" } }, "required": ["type"] }, "then": { "required": ["parent_id"] } }, |
| 33 | + { "if": { "properties": { "type": { "const": "deleted" } }, "required": ["type"] }, "then": { "required": ["deleted_at"] } }, |
| 34 | + { "if": { "properties": { "deleted_at": { "type": "string" } }, "required": ["deleted_at"] }, "then": { "properties": { "type": { "enum": ["deleted"] } } } }, |
| 35 | + { "if": { "properties": { "pinned_by_id": { "type": "string" } }, "required": ["pinned_by_id"] }, "then": { "required": ["pinned_at"] } }, |
| 36 | + { "if": { "properties": { "pinned_at": { "type": "string" } }, "required": ["pinned_at"] }, "then": { "required": ["pinned_by_id"] } }, |
| 37 | + { "if": { "properties": { "pin_expires": { "type": "string" } }, "required": ["pin_expires"] }, "then": { "required": ["pinned_at", "pinned_by_id"] } } |
| 38 | + ] |
| 39 | +} |
0 commit comments