From 0400b12566d0851a7864090acab384e2e7e9b6a9 Mon Sep 17 00:00:00 2001 From: ReaperOfVeriod Date: Sun, 25 Oct 2026 06:12:38 +0100 Subject: [PATCH] Add typed command argument contract --- README.md | 3 +++ .../v1/bot-command-argument-definition.json | 17 +++++++++++++++++ .../v1/bot-command-argument-definition.json | 9 +++++++++ 3 files changed, 29 insertions(+) create mode 100644 contracts/v1/bot-command-argument-definition.json create mode 100644 fixtures/v1/bot-command-argument-definition.json diff --git a/README.md b/README.md index 089b0bf..efbb010 100644 --- a/README.md +++ b/README.md @@ -43,3 +43,6 @@ contain only local synthetic data. Named-user command rules use `bot-command-user-rule.json`; fixtures contain only synthetic Twitch IDs and literal response templates. +Typed command arguments use `bot-command-argument-definition.json` and remain +literal validated data. + diff --git a/contracts/v1/bot-command-argument-definition.json b/contracts/v1/bot-command-argument-definition.json new file mode 100644 index 0000000..e8df7ba --- /dev/null +++ b/contracts/v1/bot-command-argument-definition.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://trixie.invalid/contracts/v1/bot-command-argument-definition.json", + "title": "Trixie typed bot command argument", + "type": "object", + "additionalProperties": false, + "required": ["name", "kind", "required"], + "properties": { + "name": { "type": "string", "pattern": "^[A-Za-z0-9_]{1,64}$" }, + "kind": { "enum": ["text", "number", "choice", "username", "duration"] }, + "required": { "type": "boolean" }, + "default": { "type": ["string", "null"], "maxLength": 200 }, + "minimum": { "type": ["integer", "null"] }, + "maximum": { "type": ["integer", "null"] }, + "choices": { "type": "array", "maxItems": 64, "items": { "type": "string", "minLength": 1, "maxLength": 200 } } + } +} diff --git a/fixtures/v1/bot-command-argument-definition.json b/fixtures/v1/bot-command-argument-definition.json new file mode 100644 index 0000000..3e3ef01 --- /dev/null +++ b/fixtures/v1/bot-command-argument-definition.json @@ -0,0 +1,9 @@ +{ + "name": "count", + "kind": "number", + "required": true, + "default": null, + "minimum": 1, + "maximum": 5, + "choices": [] +}