From 14c5d9eb177cee719843336512b587780b59c452 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 21 Sep 2023 22:41:32 +0300 Subject: [PATCH] Better schema for checking field names --- .idea/inspectionProfiles/Project_Default.xml | 1 - .../jsons/Civ V - Gods & Kings/Buildings.json | 2 +- docs/Modders/schemas/building.json | 75 ----------------- docs/Modders/schemas/buildings.json | 83 +++++++++++++++++++ 4 files changed, 84 insertions(+), 77 deletions(-) delete mode 100644 docs/Modders/schemas/building.json create mode 100644 docs/Modders/schemas/buildings.json diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 09e615327e..812938c727 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -7,7 +7,6 @@ - diff --git a/android/assets/jsons/Civ V - Gods & Kings/Buildings.json b/android/assets/jsons/Civ V - Gods & Kings/Buildings.json index e36c5edf02..7b24d64490 100644 --- a/android/assets/jsons/Civ V - Gods & Kings/Buildings.json +++ b/android/assets/jsons/Civ V - Gods & Kings/Buildings.json @@ -23,7 +23,7 @@ }, { "name": "Stele", - "replaces": "Monument", + "replaces": "Monument", "uniqueTo": "Ethiopia", "culture": 2, "faith": 2, diff --git a/docs/Modders/schemas/building.json b/docs/Modders/schemas/building.json deleted file mode 100644 index 659ffcaf0f..0000000000 --- a/docs/Modders/schemas/building.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema", - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { "type": "string" }, - "uniques": { - "type": "array", - "items": { "type": "string" } - }, - "civilopediaText": { - "type": "array", - "items": { "$ref": "#/definitions/civilopediaText"} - }, - "requiredTech": { "type": "string" }, - "cost": { "type": "number" }, - "maintenance": { "type": "number" }, - "percentStatBonus": { "$ref": "#/definitions/stats" }, - "specialistSlots": { "type": "object" }, - "greatPersonPoints": { "type": "object" }, - "hurryCostModifier": { "type": "number" }, - "isWonder": { "type": "boolean" }, - "isNationalWonder": { "type": "boolean" }, - "requiredBuilding": { "type": "string" }, - "requiredResource": { "type": "string" }, - "requiredNearbyImprovedResources": { - "type": "array", - "items": { "type": "string" } - }, - "cityStrength": { "type": "number" }, - "cityHealth": { "type": "number" }, - "replaces": { "type": "string" }, - "uniqueTo": { "type": "string" }, - "quote": { "type": "string" }, - "replacementTextForUniques": { "type": "string" } - }, - "required": [ - "name" - ] - }, - "definitions": { - "stats": { - "type": "object", - "properties": { - "production": { "type": "number" }, - "food": { "type": "number" }, - "gold": { "type": "number" }, - "science": { "type": "number" }, - "culture": { "type": "number" }, - "happiness": { "type": "number" }, - "faith": { "type": "number" } - } - }, - "civilopediaText": { - "type": "object", - "properties": { - "text": { "type": "string" }, - "link": { "type": "string" }, - "icon": { "type": "string" }, - "extraImage": { "type": "string" }, - "imageSize": { "type": "number" }, - "size": { "type": "number" }, - "header": { "type": "number" }, - "indent": { "type": "number" }, - "padding": { "type": "number" }, - "color": { "type": "string" }, - "separator": { "type": "boolean" }, - "starred": { "type": "boolean" }, - "centered": { "type": "boolean" }, - "iconCrossed": { "type": "boolean" } - } - } - } -} diff --git a/docs/Modders/schemas/buildings.json b/docs/Modders/schemas/buildings.json new file mode 100644 index 0000000000..7e88fd0889 --- /dev/null +++ b/docs/Modders/schemas/buildings.json @@ -0,0 +1,83 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "array", + "items": { + "allOf": [ + { "$ref": "#/definitions/stats"}, + { + "type": "object", + "properties": { + "name": { "type": "string" }, + "uniques": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true // Can't imagine you mean to include the same thing twice + }, + "civilopediaText": { + "type": "array", + "items": { "$ref": "#/definitions/civilopediaText"} + }, + "requiredTech": { "type": "string" }, + "cost": { "type": "number" }, + "maintenance": { "type": "number" }, + "percentStatBonus": { "$ref": "#/definitions/stats" }, + "specialistSlots": { "type": "object" }, + "greatPersonPoints": { "type": "object" }, + "hurryCostModifier": { "type": "number" }, + "isWonder": { "type": "boolean" }, + "isNationalWonder": { "type": "boolean" }, + "requiredBuilding": { "type": "string" }, + "requiredResource": { "type": "string" }, + "requiredNearbyImprovedResources": { + "type": "array", + "items": { "type": "string" } + }, + "cityStrength": { "type": "number" }, + "cityHealth": { "type": "number" }, + "replaces": { "type": "string" }, + "uniqueTo": { "type": "string" }, + "quote": { "type": "string" }, + "replacementTextForUniques": { "type": "string" } + }, + "required": [ + "name" + ], + "additionalProperties": false, + } + ], + }, + "definitions": { + "stats": { + "type": "object", + "properties": { + "production": { "type": "number" }, + "food": { "type": "number" }, + "gold": { "type": "number" }, + "science": { "type": "number" }, + "culture": { "type": "number" }, + "happiness": { "type": "number" }, + "faith": { "type": "number" } + }, + "additionalProperties": false + }, + "civilopediaText": { + "type": "object", + "properties": { + "text": { "type": "string" }, + "link": { "type": "string" }, + "icon": { "type": "string" }, + "extraImage": { "type": "string" }, + "imageSize": { "type": "number" }, + "size": { "type": "number" }, + "header": { "type": "number" }, + "indent": { "type": "number" }, + "padding": { "type": "number" }, + "color": { "type": "string" }, + "separator": { "type": "boolean" }, + "starred": { "type": "boolean" }, + "centered": { "type": "boolean" }, + "iconCrossed": { "type": "boolean" } + } + } + } +}