From 1891a37c66d5f12b03497e42b0eadcf74f67a859 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Fri, 22 Sep 2023 10:47:56 +0300 Subject: [PATCH] Added pattern to uniques to catch bugs --- docs/Modders/Type-checking.md | 9 ++++++++- docs/Modders/schemas/uniques.json | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/Modders/Type-checking.md b/docs/Modders/Type-checking.md index 7aa8414dde..0a866af338 100644 --- a/docs/Modders/Type-checking.md +++ b/docs/Modders/Type-checking.md @@ -6,10 +6,11 @@ Computers can handle a lot of that themselves, so we can let them do the work to This also allows autocompletion when writing jsons! -As of now, only Buildings.json has a proper schema +As of now, only Buildings and Units have proper schema ## Using Android Studio + - Double-click space, search "json schema mappings", enter - Click the small '+' (top, under 'language & frameworks' text) - Put the URL as `https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/buildings.json` @@ -28,6 +29,12 @@ Tada! Now Android Studio will recognize all Buildings.json files as belonging to "*/Buildings.json" ], "url": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/buildings.json" + }, + { + "fileMatch": [ + "*/Units.json" + ], + "url": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/units.json" } ] ``` diff --git a/docs/Modders/schemas/uniques.json b/docs/Modders/schemas/uniques.json index 8e975ce420..7f885c4bda 100644 --- a/docs/Modders/schemas/uniques.json +++ b/docs/Modders/schemas/uniques.json @@ -1,4 +1,7 @@ { "type": "array", - "items": { "type": "string" } + "items": { + "type": "string", + "pattern": "^[^><]*(\\<[^>]*\\>[^><]*)*$" + } }