From 9ea441ab736de62336bddbf5cfed65f46f2dd681 Mon Sep 17 00:00:00 2001 From: LemmaEOF <6722691+LemmaEOF@users.noreply.github.com> Date: Mon, 5 Jan 2026 18:50:22 -0800 Subject: [PATCH] improve type schema --- schema/chart.json | 20 ++++++-------------- schema/difficulty.json | 27 +++++++++++++++++++++++++++ schema/score.json | 2 +- schema/types.json | 23 +++++++++++++++++++++++ 4 files changed, 57 insertions(+), 15 deletions(-) create mode 100644 schema/difficulty.json create mode 100644 schema/types.json diff --git a/schema/chart.json b/schema/chart.json index 128f937..25389dc 100644 --- a/schema/chart.json +++ b/schema/chart.json @@ -21,20 +21,12 @@ "format": "at-uri" }, "difficulty": { - "type": "object", - "description": "The difficulty slot this chart is placed in. TODO: make this a separate record?", - "properties": { - "name": { - "type": "ref", - "description": "The human-readable name of the difficulty slot for use in UI.", - "ref": "dev.tsunagite.translatable" - }, - "color": { - "type": "string", - "description": "The hex code color of the difficulty slot. TODO: make this a struct?" - } - }, - "required": ["name"] + "type": "union", + "description": "The difficulty slot this chart is placed in. Can be an inline definition or a reference to a standard-defined difficulty slot.", + "refs": [ + "dev.tsunagite.difficulty", + "dev.tsunagite.types#typedRef" + ] }, "rating": { "type": "string", diff --git a/schema/difficulty.json b/schema/difficulty.json new file mode 100644 index 0000000..674d591 --- /dev/null +++ b/schema/difficulty.json @@ -0,0 +1,27 @@ +{ + "lexicon": 1, + "id": "dev.tsunagite.difficulty", + "description": "Definitions related to difficulty slots in games hosting leaderboards via Tsunagite.", + "defs": { + "main": { + "type": "record", + "description": "A difficulty slot in a game hosting leaderboards via Tsunagite.", + "key": "any", + "record": { + "type": "object", + "properties": { + "name": { + "type": "ref", + "description": "The human-readable name of the difficulty slot for use in UI.", + "ref": "dev.tsunagite.translatable" + }, + "color": { + "type": "string", + "description": "The hex code color of the difficulty slot." + } + }, + "required": ["name"] + } + } + } +} \ No newline at end of file diff --git a/schema/score.json b/schema/score.json index be8c336..90c16d7 100644 --- a/schema/score.json +++ b/schema/score.json @@ -111,7 +111,7 @@ }, "judgments": { "type": "object", - "description": "A map of judgment names to the integer judgment amounts earned during play. TODO: formatting requirements", + "description": "A map of judgment names to the integer judgment amounts earned during play. Each value must be a single integer or an object with `total`, `early`, and `late` fields.", "properties": {} }, "scoreComponents": { diff --git a/schema/types.json b/schema/types.json new file mode 100644 index 0000000..7278377 --- /dev/null +++ b/schema/types.json @@ -0,0 +1,23 @@ +{ + "lexicon": 1, + "id": "dev.tsunagite.types", + "description": "Assistant data types for Tsunagite lexicons.", + "defs": { + "typedRef": { + "type": "object", + "description": "A typed record reference that does not require a CID hash.", + "properties": { + "ref": { + "type": "string", + "description": "The AT URI of the record this object references.", + "format": "at-uri" + }, + "type": { + "type": "string", + "description": "The type of the record this object references.", + "format": "record-key" + } + } + } + } +} \ No newline at end of file -- 2.51.2