Instructions for setting up schemas on Visual Studio

This commit is contained in:
Yair Morgenstern 2023-09-21 23:21:30 +03:00
parent ab3a04f50f
commit ba2a9e7127
2 changed files with 58 additions and 40 deletions

View File

@ -15,3 +15,17 @@ As of now, only Buildings.json has a proper schema
Tada! Now Android Studio will recognize all Buildings.json files as belonging to that schema, and will warn you of inconsistencies! Tada! Now Android Studio will recognize all Buildings.json files as belonging to that schema, and will warn you of inconsistencies!
## Using VSCode
- ctrl-shift-p, search "open user settings (json)", enter
- Copy this into the settings:
```json
"json.schemas": [
{
"fileMatch": [
"*/Buildings.json"
],
"url": "https://raw.githubusercontent.com/yairm210/Unciv/14c5d9eb177cee719843336512b587780b59c452/docs/Modders/schemas/buildings.json"
}
]
```

View File

@ -2,6 +2,9 @@
"$schema": "http://json-schema.org/draft-07/schema", "$schema": "http://json-schema.org/draft-07/schema",
"type": "array", "type": "array",
"items": { "items": {
"allOf": [
{ "$ref": "#/definitions/stats"},
{
"type": "object", "type": "object",
"properties": { "properties": {
"name": { "type": "string" }, "name": { "type": "string" },
@ -42,8 +45,9 @@
"required": [ "required": [
"name" "name"
], ],
"allOf": [{ "$ref": "#/definitions/stats"}],
"additionalProperties": false "additionalProperties": false
}
],
}, },
"definitions": { "definitions": {
"stats": { "stats": {