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:
17
schema/c2s/join.json
Normal file
17
schema/c2s/join.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/c2s/join.json",
|
||||
"title": "C2S Join",
|
||||
"description": "Join a channel. Submitted via POST /api/v1/channels/join.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channel": {
|
||||
"type": "string",
|
||||
"description": "Channel name (# prefix optional, server will add it).",
|
||||
"pattern": "^#?[a-zA-Z0-9_-]+$",
|
||||
"examples": ["#general", "dev"]
|
||||
}
|
||||
},
|
||||
"required": ["channel"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
26
schema/c2s/mode.json
Normal file
26
schema/c2s/mode.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/c2s/mode.json",
|
||||
"title": "C2S Mode",
|
||||
"description": "Set channel or user mode flags.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channel": {
|
||||
"type": "string",
|
||||
"description": "Target channel.",
|
||||
"pattern": "^#[a-zA-Z0-9_-]+$"
|
||||
},
|
||||
"mode": {
|
||||
"type": "string",
|
||||
"description": "Mode string (e.g. +o, -m, +v).",
|
||||
"pattern": "^[+-][a-zA-Z]+$",
|
||||
"examples": ["+o", "-m", "+v", "+i"]
|
||||
},
|
||||
"target": {
|
||||
"type": "string",
|
||||
"description": "Target nick for user modes (e.g. +o alice). Omit for channel modes."
|
||||
}
|
||||
},
|
||||
"required": ["channel", "mode"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
18
schema/c2s/nick.json
Normal file
18
schema/c2s/nick.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/c2s/nick.json",
|
||||
"title": "C2S Nick",
|
||||
"description": "Change the user's nickname.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"nick": {
|
||||
"type": "string",
|
||||
"description": "Desired new nickname.",
|
||||
"minLength": 1,
|
||||
"maxLength": 32,
|
||||
"pattern": "^[a-zA-Z][a-zA-Z0-9_-]*$"
|
||||
}
|
||||
},
|
||||
"required": ["nick"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
22
schema/c2s/part.json
Normal file
22
schema/c2s/part.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/c2s/part.json",
|
||||
"title": "C2S Part",
|
||||
"description": "Leave a channel. Submitted via DELETE /api/v1/channels/{name}.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channel": {
|
||||
"type": "string",
|
||||
"description": "Channel name to leave.",
|
||||
"pattern": "^#[a-zA-Z0-9_-]+$",
|
||||
"examples": ["#general"]
|
||||
},
|
||||
"reason": {
|
||||
"type": "string",
|
||||
"description": "Optional part reason message.",
|
||||
"maxLength": 256
|
||||
}
|
||||
},
|
||||
"required": ["channel"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
14
schema/c2s/ping.json
Normal file
14
schema/c2s/ping.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/c2s/ping.json",
|
||||
"title": "C2S Ping",
|
||||
"description": "Client keepalive. Server responds with a pong.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string",
|
||||
"description": "Optional opaque token echoed back in the pong response."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
22
schema/c2s/send.json
Normal file
22
schema/c2s/send.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/c2s/send.json",
|
||||
"title": "C2S Send",
|
||||
"description": "Send a message to a channel or user. Submitted via POST /api/v1/messages.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"to": {
|
||||
"type": "string",
|
||||
"description": "Target: channel name (prefixed with #) or nick for DM.",
|
||||
"examples": ["#general", "alice"]
|
||||
},
|
||||
"content": {
|
||||
"type": "string",
|
||||
"description": "Message body (UTF-8 text).",
|
||||
"minLength": 1,
|
||||
"maxLength": 4096
|
||||
}
|
||||
},
|
||||
"required": ["to", "content"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
21
schema/c2s/topic.json
Normal file
21
schema/c2s/topic.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.eeqj.de/sneak/chat/schema/c2s/topic.json",
|
||||
"title": "C2S Topic",
|
||||
"description": "Set a channel's topic.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channel": {
|
||||
"type": "string",
|
||||
"description": "Target channel.",
|
||||
"pattern": "^#[a-zA-Z0-9_-]+$"
|
||||
},
|
||||
"topic": {
|
||||
"type": "string",
|
||||
"description": "New topic text. Empty string clears the topic.",
|
||||
"maxLength": 512
|
||||
}
|
||||
},
|
||||
"required": ["channel", "topic"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
Reference in New Issue
Block a user