refactor: model message schemas after IRC RFC 1459/2812
Replace c2s/s2c/s2s taxonomy with IRC-native structure: - schema/commands/ — IRC command schemas (PRIVMSG, NOTICE, JOIN, PART, QUIT, NICK, TOPIC, MODE, KICK, PING, PONG) - schema/numerics/ — IRC numeric reply codes (001-004, 322-323, 332, 353, 366, 372-376, 401, 403, 433, 442, 482) - schema/message.json — base envelope mapping IRC wire format to JSON Messages use 'command' field with IRC command names or 3-digit numeric codes. 'body' is a string (IRC trailing parameter), not object/array. 'from'/'to' map to IRC prefix and first parameter. Federation uses the same IRC commands (no custom RELAY/LINK/SYNC). Update README message format, command tables, and examples to match.
This commit is contained in:
46
schema/message.json
Normal file
46
schema/message.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/message.json",
|
||||
"title": "IRC Message Envelope",
|
||||
"description": "Base envelope for all messages. Mirrors IRC wire format (RFC 1459/2812) encoded as JSON over HTTP. The 'command' field carries either an IRC command name (PRIVMSG, JOIN, etc.) or a three-digit numeric reply code (001, 353, 433, etc.).",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"description": "Server-assigned message ID, monotonically increasing. Present on all server-originated messages."
|
||||
},
|
||||
"command": {
|
||||
"type": "string",
|
||||
"description": "IRC command name (PRIVMSG, JOIN, NICK, etc.) or three-digit numeric reply code (001, 353, 433, etc.).",
|
||||
"examples": ["PRIVMSG", "JOIN", "001", "353", "433"]
|
||||
},
|
||||
"from": {
|
||||
"type": "string",
|
||||
"description": "Source — nick for user messages, server name for server messages. Equivalent to IRC prefix."
|
||||
},
|
||||
"to": {
|
||||
"type": "string",
|
||||
"description": "Target — channel (#name) or nick. Equivalent to first IRC parameter for most commands."
|
||||
},
|
||||
"params": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" },
|
||||
"description": "Additional parameters (used primarily by numeric replies). Equivalent to IRC middle parameters."
|
||||
},
|
||||
"body": {
|
||||
"type": "string",
|
||||
"description": "Message body / trailing parameter. Equivalent to IRC trailing parameter (after the colon)."
|
||||
},
|
||||
"ts": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "Server-assigned timestamp (ISO 8601). Not present in original IRC; added for HTTP transport."
|
||||
},
|
||||
"meta": {
|
||||
"type": "object",
|
||||
"description": "Extensible metadata (signatures, rich content hints, etc.). Not present in original IRC.",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"required": ["command"]
|
||||
}
|
||||
Reference in New Issue
Block a user