From 46dd1cfc196a23bf14a80b523dfad18e25c7a3a2 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 24 Sep 2023 12:24:41 +0300 Subject: [PATCH] Added unitTypes json schema --- docs/Modders/Type-checking.md | 10 ++++++++-- docs/Modders/schemas/tileImprovements.json | 2 +- docs/Modders/schemas/unitTypes.json | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 docs/Modders/schemas/unitTypes.json diff --git a/docs/Modders/Type-checking.md b/docs/Modders/Type-checking.md index 1c48e030fc..47b72c7c89 100644 --- a/docs/Modders/Type-checking.md +++ b/docs/Modders/Type-checking.md @@ -50,9 +50,15 @@ Tada! Now Android Studio will recognize all Buildings.json files as belonging to }, { "fileMatch": [ - "*/TileImprovements.json" + "*/Techs.json" ], - "url": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/tileImprovements.json" + "url": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/techs.json" + }, + { + "fileMatch": [ + "*/UnitTypes.json" + ], + "url": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/unitTypes.json" } ] ``` diff --git a/docs/Modders/schemas/tileImprovements.json b/docs/Modders/schemas/tileImprovements.json index d024c9aec1..5d90ab0675 100644 --- a/docs/Modders/schemas/tileImprovements.json +++ b/docs/Modders/schemas/tileImprovements.json @@ -8,7 +8,7 @@ "terrainsCanBeBuiltOn": { "type": "array", "items": { "type": "string" }, - "uniqueItems": true, + "uniqueItems": true }, "turnsToBuild": { "type": "integer" }, "techRequired": { "type": "string" }, diff --git a/docs/Modders/schemas/unitTypes.json b/docs/Modders/schemas/unitTypes.json new file mode 100644 index 0000000000..665c699012 --- /dev/null +++ b/docs/Modders/schemas/unitTypes.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "movementType": { + "enum": ["Land", "Water", "Air"] + }, + "uniques": { "$ref": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/uniques.json" }, + "civilopediaText": { "$ref": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/civilopediaText.json" } + }, + "required": [ + "name", "movementType" + ], + "additionalProperties": false + } +}