docs: add JSON Schema definitions for all message types (draft 2020-12)
C2S (7): send, join, part, nick, topic, mode, ping
S2C (12): message, dm, notice, join, part, quit, nick, topic, mode, system, error, pong
S2S (6): relay, link, unlink, sync, ping, pong
Each message type has its own schema file under schema/{c2s,s2c,s2s}/.
schema/README.md provides an index of all types with descriptions.
This commit is contained in:
40
schema/s2c/message.json
Normal file
40
schema/s2c/message.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/s2c/message.json",
|
||||
"title": "S2C Message",
|
||||
"description": "A channel message delivered via the unified message stream.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"description": "Server-assigned message ID, monotonically increasing."
|
||||
},
|
||||
"type": {
|
||||
"const": "message"
|
||||
},
|
||||
"ts": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "Server-assigned timestamp (ISO 8601)."
|
||||
},
|
||||
"from": {
|
||||
"type": "string",
|
||||
"description": "Sender nick."
|
||||
},
|
||||
"channel": {
|
||||
"type": "string",
|
||||
"description": "Channel the message was sent to.",
|
||||
"pattern": "^#[a-zA-Z0-9_-]+$"
|
||||
},
|
||||
"content": {
|
||||
"type": "string",
|
||||
"description": "Message body."
|
||||
},
|
||||
"meta": {
|
||||
"type": "object",
|
||||
"description": "Extensible metadata (signatures, rich content, etc.).",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"required": ["id", "type", "ts", "from", "channel", "content"]
|
||||
}
|
||||
Reference in New Issue
Block a user