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:
41
schema/s2s/link.json
Normal file
41
schema/s2s/link.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/s2s/link.json",
|
||||
"title": "S2S Link",
|
||||
"description": "Server link establishment request/response.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"type": {
|
||||
"const": "link"
|
||||
},
|
||||
"ts": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"origin": {
|
||||
"type": "string",
|
||||
"description": "Requesting server name."
|
||||
},
|
||||
"version": {
|
||||
"type": "string",
|
||||
"description": "Protocol version of the requesting server."
|
||||
},
|
||||
"auth": {
|
||||
"type": "string",
|
||||
"description": "HMAC signature over the link request using the shared federation key."
|
||||
},
|
||||
"capabilities": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "List of supported protocol capabilities.",
|
||||
"examples": [["relay", "sync", "presence"]]
|
||||
}
|
||||
},
|
||||
"required": ["id", "type", "ts", "origin", "auth"]
|
||||
}
|
||||
29
schema/s2s/ping.json
Normal file
29
schema/s2s/ping.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/s2s/ping.json",
|
||||
"title": "S2S Ping",
|
||||
"description": "Inter-server keepalive.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"type": {
|
||||
"const": "ping"
|
||||
},
|
||||
"ts": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"origin": {
|
||||
"type": "string",
|
||||
"description": "Pinging server."
|
||||
},
|
||||
"token": {
|
||||
"type": "string",
|
||||
"description": "Opaque token to be echoed in pong."
|
||||
}
|
||||
},
|
||||
"required": ["id", "type", "ts", "origin"]
|
||||
}
|
||||
29
schema/s2s/pong.json
Normal file
29
schema/s2s/pong.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/s2s/pong.json",
|
||||
"title": "S2S Pong",
|
||||
"description": "Inter-server keepalive response.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"type": {
|
||||
"const": "pong"
|
||||
},
|
||||
"ts": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"origin": {
|
||||
"type": "string",
|
||||
"description": "Responding server."
|
||||
},
|
||||
"token": {
|
||||
"type": "string",
|
||||
"description": "Echoed token from the ping."
|
||||
}
|
||||
},
|
||||
"required": ["id", "type", "ts", "origin"]
|
||||
}
|
||||
49
schema/s2s/relay.json
Normal file
49
schema/s2s/relay.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/s2s/relay.json",
|
||||
"title": "S2S Relay",
|
||||
"description": "A message relayed from a remote server in the federation.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"format": "uuid",
|
||||
"description": "Message UUID, globally unique across the federation."
|
||||
},
|
||||
"type": {
|
||||
"const": "relay"
|
||||
},
|
||||
"ts": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"origin": {
|
||||
"type": "string",
|
||||
"description": "Originating server name."
|
||||
},
|
||||
"message": {
|
||||
"type": "object",
|
||||
"description": "The original S2C message being relayed. Preserves the original type, from, channel, content, etc.",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"from": {
|
||||
"type": "string"
|
||||
},
|
||||
"channel": {
|
||||
"type": "string"
|
||||
},
|
||||
"content": {
|
||||
"type": "string"
|
||||
},
|
||||
"ts": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
},
|
||||
"required": ["type", "from"]
|
||||
}
|
||||
},
|
||||
"required": ["id", "type", "ts", "origin", "message"]
|
||||
}
|
||||
69
schema/s2s/sync.json
Normal file
69
schema/s2s/sync.json
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/s2s/sync.json",
|
||||
"title": "S2S Sync",
|
||||
"description": "State synchronization between federated servers. Sent after link establishment to share channel and user state.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"type": {
|
||||
"const": "sync"
|
||||
},
|
||||
"ts": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"origin": {
|
||||
"type": "string",
|
||||
"description": "Server sending the sync."
|
||||
},
|
||||
"channels": {
|
||||
"type": "array",
|
||||
"description": "Channels on the origin server.",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"pattern": "^#[a-zA-Z0-9_-]+$"
|
||||
},
|
||||
"topic": {
|
||||
"type": "string"
|
||||
},
|
||||
"modes": {
|
||||
"type": "string"
|
||||
},
|
||||
"members": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "List of nicks in the channel."
|
||||
}
|
||||
},
|
||||
"required": ["name"]
|
||||
}
|
||||
},
|
||||
"users": {
|
||||
"type": "array",
|
||||
"description": "Users on the origin server.",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"nick": {
|
||||
"type": "string"
|
||||
},
|
||||
"server": {
|
||||
"type": "string",
|
||||
"description": "Home server for this user."
|
||||
}
|
||||
},
|
||||
"required": ["nick"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["id", "type", "ts", "origin"]
|
||||
}
|
||||
30
schema/s2s/unlink.json
Normal file
30
schema/s2s/unlink.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/s2s/unlink.json",
|
||||
"title": "S2S Unlink",
|
||||
"description": "Server link teardown notification.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"type": {
|
||||
"const": "unlink"
|
||||
},
|
||||
"ts": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"origin": {
|
||||
"type": "string",
|
||||
"description": "Server initiating the unlink."
|
||||
},
|
||||
"reason": {
|
||||
"type": "string",
|
||||
"description": "Optional reason for the unlink.",
|
||||
"examples": ["shutdown", "configuration change", "timeout"]
|
||||
}
|
||||
},
|
||||
"required": ["id", "type", "ts", "origin"]
|
||||
}
|
||||
Reference in New Issue
Block a user