diff --git a/config/schemas/artifact.json b/config/schemas/artifact.json index 5cf42b663..691a05b88 100644 --- a/config/schemas/artifact.json +++ b/config/schemas/artifact.json @@ -15,7 +15,7 @@ "level" : { "type" : "number" }, - "bonus" : { "$ref" : "vcmi:bonus" } + "bonus" : { "$ref" : "bonus.json" } } } } @@ -26,7 +26,7 @@ "bonuses": { "type":"array", "description": "Bonuses provided by this artifact using bonus system", - "items": { "$ref" : "vcmi:bonus" } + "items": { "$ref" : "bonus.json" } }, "class": { "type":"string", diff --git a/config/schemas/bonus.json b/config/schemas/bonus.json index 31a1eaea7..901fbd25e 100644 --- a/config/schemas/bonus.json +++ b/config/schemas/bonus.json @@ -25,7 +25,7 @@ "type" : "array", "description" : "parameters", "additionalItems" : true - }, + } } }, { diff --git a/config/schemas/creature.json b/config/schemas/creature.json index 868ce50cf..b5040720d 100644 --- a/config/schemas/creature.json +++ b/config/schemas/creature.json @@ -135,7 +135,7 @@ "description": "Creature abilities described using Bonus system", "type":"object", "additionalProperties": { - "$ref" : "vcmi:bonus" + "$ref" : "bonus.json" } }, "stackExperience": { @@ -147,7 +147,7 @@ "required" : [ "bonus", "values" ], "description": "0", "properties":{ - "bonus": {"$ref" : "vcmi:bonus" }, + "bonus": {"$ref" : "bonus.json" }, "values": { "type":"array", "minItems" : 10, diff --git a/config/schemas/faction.json b/config/schemas/faction.json index 016a97bef..a31d0f718 100644 --- a/config/schemas/faction.json +++ b/config/schemas/faction.json @@ -156,7 +156,7 @@ "buildings": { "type" : "object", "additionalProperties" : { - "$ref" : "vcmi:townBuilding" + "$ref" : "townBuilding.json" } }, "creatures": { @@ -241,12 +241,12 @@ "format" : "musicFile" }, "siege": { - "$ref" : "vcmi:townSiege" + "$ref" : "townSiege.json" }, "structures": { "type" : "object", "additionalProperties" : { - "$ref" : "vcmi:townStructure" + "$ref" : "townStructure.json" } }, "townBackground": { diff --git a/config/schemas/hero.json b/config/schemas/hero.json index e584d2fb4..00715bc34 100644 --- a/config/schemas/hero.json +++ b/config/schemas/hero.json @@ -136,7 +136,7 @@ "bonuses" : { "type" : "array", "description" : "List of bonuses", - "items" : { "$ref" : "vcmi:bonus" } + "items" : { "$ref" : "bonus.json" } } } } @@ -153,7 +153,7 @@ "bonuses" : { "type" : "object", "description" : "Set of bonuses", - "additionalProperties" : { "$ref" : "vcmi:bonus" } + "additionalProperties" : { "$ref" : "bonus.json" } }, "creature" : { "type" : "string", diff --git a/config/schemas/mapHeader.json b/config/schemas/mapHeader.json index f73aeed2f..2ad23ce7e 100644 --- a/config/schemas/mapHeader.json +++ b/config/schemas/mapHeader.json @@ -41,7 +41,7 @@ "properties" : { "type" : { "type" : "string" }, - "messageToSend" : { "type" : "string" }, + "messageToSend" : { "type" : "string" } } } } diff --git a/config/schemas/object.json b/config/schemas/object.json index d5c2c9b78..7c1daba0e 100644 --- a/config/schemas/object.json +++ b/config/schemas/object.json @@ -8,17 +8,17 @@ "properties":{ "index": { - "type":"number", + "type":"number" }, "name": { - "type":"string", + "type":"string" }, "defaultAiValue": { - "type":"number", + "type":"number" }, "handler": { - "type":"string", + "type":"string" }, "sounds": { @@ -56,7 +56,7 @@ "types": { "type":"object", "additionalProperties": { - "$ref" : "vcmi:objectType" + "$ref" : "objectType.json" } } } diff --git a/config/schemas/objectType.json b/config/schemas/objectType.json index 52797c95b..b5e80c935 100644 --- a/config/schemas/objectType.json +++ b/config/schemas/objectType.json @@ -8,13 +8,13 @@ "properties":{ "index": { - "type":"number", + "type":"number" }, "name": { - "type":"string", + "type":"string" }, "aiValue": { - "type":"number", + "type":"number" }, "sounds": { @@ -52,7 +52,7 @@ "templates": { "type":"object", "additionalProperties": { - "$ref" : "vcmi:objectTemplate" + "$ref" : "objectTemplate.json" } } } diff --git a/config/schemas/skill.json b/config/schemas/skill.json index 24e5013d2..0a191c61e 100644 --- a/config/schemas/skill.json +++ b/config/schemas/skill.json @@ -41,7 +41,7 @@ "effects" : { "type" : "object", "additionalProperties" : { - "$ref" : "vcmi:bonus" + "$ref" : "bonus.json" } } } diff --git a/config/schemas/spell.json b/config/schemas/spell.json index daec57499..b8f2db0ad 100644 --- a/config/schemas/spell.json +++ b/config/schemas/spell.json @@ -73,10 +73,10 @@ "description":"Cost in mana points" }, "power":{ - "type": "number", + "type": "number" }, "aiValue":{ - "type": "number", + "type": "number" }, "range":{ @@ -87,14 +87,14 @@ "type": "object", "description": "Timed effects (updated by prolongation)", "additionalProperties" : { - "$ref" : "vcmi:bonus" + "$ref" : "bonus.json" } }, "cumulativeEffects":{ "type": "object", "description": "Timed effects (updated by unique bonus)", "additionalProperties" : { - "$ref" : "vcmi:bonus" + "$ref" : "bonus.json" } }, "battleEffects":{ @@ -175,7 +175,7 @@ "power":{ "type": "number", - "description": "Base power", + "description": "Base power" }, "defaultGainChance":{ diff --git a/lib/JsonNode.cpp b/lib/JsonNode.cpp index 9d7766d09..fee986eed 100644 --- a/lib/JsonNode.cpp +++ b/lib/JsonNode.cpp @@ -904,7 +904,7 @@ const JsonNode & getSchemaByName(std::string name) if (vstd::contains(loadedSchemas, name)) return loadedSchemas[name]; - std::string filename = "config/schemas/" + name + ".json"; + std::string filename = "config/schemas/" + name; if (CResourceHandler::get()->existsResource(ResourceID(filename))) { @@ -921,19 +921,20 @@ const JsonNode & JsonUtils::getSchema(std::string URI) { size_t posColon = URI.find(':'); size_t posHash = URI.find('#'); + std::string filename; if(posColon == std::string::npos) { - logMod->error("Invalid schema URI:%s", URI); - return nullNode; + filename = URI.substr(0, posHash); } - - std::string protocolName = URI.substr(0, posColon); - std::string filename = URI.substr(posColon + 1, posHash - posColon - 1); - - if(protocolName != "vcmi") + else { - logMod->error("Error: unsupported URI protocol for schema: %s", URI); - return nullNode; + std::string protocolName = URI.substr(0, posColon); + filename = URI.substr(posColon + 1, posHash - posColon - 1) + ".json"; + if(protocolName != "vcmi") + { + logMod->error("Error: unsupported URI protocol for schema: %s", URI); + return nullNode; + } } // check if json pointer if present (section after hash in string)