Better schema for checking field names

This commit is contained in:
Yair Morgenstern 2023-09-21 22:41:32 +03:00
parent da28d275be
commit 14c5d9eb17
4 changed files with 84 additions and 77 deletions

View File

@ -7,7 +7,6 @@
<inspection_tool class="JsonPathEvaluateUnknownKey" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JsonPathUnknownFunction" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JsonPathUnknownOperator" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JsonSchemaCompliance" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JsonSchemaDeprecation" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="JsonSchemaRefReference" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JsonStandardCompliance" enabled="false" level="ERROR" enabled_by_default="false" />

View File

@ -23,7 +23,7 @@
},
{
"name": "Stele",
"replaces": "Monument",
"replaces": "Monument",
"uniqueTo": "Ethiopia",
"culture": 2,
"faith": 2,

View File

@ -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" }
}
}
}
}

View File

@ -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" }
}
}
}
}