Skip to content

Commit 9b0bbe6

Browse files
authored
Merge pull request #5 from AlamoEngine-Tools/features/gruenwaldlk/release_0_3_0
Schema Changes for 0.3.0
2 parents 6b1bc94 + 487d147 commit 9b0bbe6

55 files changed

Lines changed: 1375 additions & 108 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: validate-schema
2+
3+
# Guards the schema data against the class of mistake that is invisible in review and silent at
4+
# runtime. The C# loader is deliberately lenient - a malformed file, an unknown tag type, or a
5+
# misspelled key produces at most a log warning, and a YAML syntax error takes out the whole game
6+
# schema (no hover, no completion, no validation) with an error that names no file. CI catches all
7+
# three before merge.
8+
9+
on:
10+
push:
11+
branches:
12+
- main
13+
pull_request:
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
validate-schema:
21+
name: validate schema files
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: checkout
26+
uses: actions/checkout@v4
27+
28+
- name: validate
29+
uses: GrantBirki/json-yaml-validate@v5
30+
with:
31+
# Validate YAML against real JSON Schema (Draft 2020-12). YAML-native schemas are ignored
32+
# in this mode, which is why every mapping below is type: json.
33+
yaml_as_json: "true"
34+
json_schema_version: draft-2020-12
35+
36+
# The schema data is one document per file; a multi-document file would be a mistake.
37+
allow_multiple_documents: "false"
38+
39+
# schema_mappings is authoritative: only files matched here are validated, and there is no
40+
# fallback to base_dir or a global schema. The leading */ covers eaw/ and foc/ alike, so a
41+
# second game's directories are picked up automatically when they appear.
42+
schema_mappings: |
43+
- type: json
44+
schema: ./.schemas/tag-file.schema.json
45+
files:
46+
- ./*/tags/*.yaml
47+
- type: json
48+
schema: ./.schemas/enum-file.schema.json
49+
files:
50+
- ./*/enums/*.yaml
51+
- type: json
52+
schema: ./.schemas/hardcoded-set-file.schema.json
53+
files:
54+
- ./*/hardcoded/*.yaml
55+
- type: json
56+
schema: ./.schemas/metafiles-file.schema.json
57+
files:
58+
- ./*/meta/*.yaml
59+
- type: json
60+
schema: ./.schemas/types-file.schema.json
61+
files:
62+
- ./*/types.yaml
63+
64+
# Report every failing file on the PR rather than making the author read the job log.
65+
comment: "true"
66+
mode: fail

.schemas/enum-file.schema.json

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://github.com/AlamoEngine-Tools/pg-starwarsgame-lsp-schema/.schemas/enum-file.schema.json",
4+
"title": "EaW/FoC LSP schema - enum file",
5+
"description": "Shape of eaw/enums/*.yaml and foc/enums/*.yaml. Mirrors YamlEnumFile/YamlEnumValueEntry.",
6+
"type": "object",
7+
"additionalProperties": false,
8+
"required": ["name"],
9+
"properties": {
10+
"name": {
11+
"description": "Enum name as referenced by a tag's enumName. Should match the file name.",
12+
"type": "string",
13+
"minLength": 1
14+
},
15+
"kind": {
16+
"description": "Where the members come from. schemaFixed = listed here; dynamicXml = harvested from workspace XML; gameConstants = read from GameConstants.",
17+
"enum": [
18+
"schemaFixed", "SchemaFixed",
19+
"dynamicXml", "DynamicXml",
20+
"gameConstants", "GameConstants"
21+
]
22+
},
23+
"isBitfield": {
24+
"description": "True when members combine as flags rather than being mutually exclusive.",
25+
"type": "boolean"
26+
},
27+
"sourceFile": {
28+
"description": "For dynamicXml enums, the game file the members are harvested from.",
29+
"type": "string",
30+
"minLength": 1
31+
},
32+
"deprecated": { "type": "boolean" },
33+
"availableSince": { "type": "string", "minLength": 1 },
34+
"description": { "$ref": "#/$defs/localisedText" },
35+
"notes": { "$ref": "#/$defs/localisedText" },
36+
"values": {
37+
"type": "array",
38+
"items": { "$ref": "#/$defs/enumValue" }
39+
}
40+
},
41+
"allOf": [
42+
{
43+
"$comment": "A schemaFixed enum lists its members here, so an empty or absent list means it validates nothing. dynamicXml and gameConstants enums harvest their members from game data at runtime and legitimately ship with no values at all.",
44+
"if": {
45+
"anyOf": [
46+
{ "properties": { "kind": { "enum": ["schemaFixed", "SchemaFixed"] } }, "required": ["kind"] },
47+
{ "not": { "required": ["kind"] } }
48+
]
49+
},
50+
"then": {
51+
"required": ["values"],
52+
"properties": { "values": { "type": "array", "minItems": 1 } }
53+
}
54+
},
55+
{
56+
"$comment": "A harvested enum needs to say where the members come from.",
57+
"if": {
58+
"properties": { "kind": { "enum": ["dynamicXml", "DynamicXml"] } },
59+
"required": ["kind"]
60+
},
61+
"then": {
62+
"$comment": "sourceFile is redeclared here only to satisfy ajv's strictRequired check.",
63+
"properties": { "sourceFile": true },
64+
"required": ["sourceFile"]
65+
}
66+
}
67+
],
68+
"$defs": {
69+
"localisedText": {
70+
"type": "object",
71+
"minProperties": 1,
72+
"additionalProperties": { "type": "string" },
73+
"propertyNames": { "pattern": "^[a-z]{2}(-[A-Za-z]{2,4})?$" }
74+
},
75+
"enumValue": {
76+
"type": "object",
77+
"additionalProperties": false,
78+
"required": ["name"],
79+
"properties": {
80+
"name": { "type": "string", "minLength": 1 },
81+
"description": { "$ref": "#/$defs/localisedText" },
82+
"notes": { "$ref": "#/$defs/localisedText" },
83+
"deprecated": { "type": "boolean" },
84+
"untested": {
85+
"description": "Member observed in game data but not confirmed to work.",
86+
"type": "boolean"
87+
},
88+
"availableSince": { "type": "string", "minLength": 1 },
89+
"groups": {
90+
"type": "array",
91+
"items": { "type": "string", "minLength": 1 }
92+
},
93+
"params": {
94+
"description": "Positional parameter slots, for story event/reward style members.",
95+
"type": "array",
96+
"items": { "$ref": "#/$defs/param" }
97+
}
98+
}
99+
},
100+
"param": {
101+
"type": "object",
102+
"additionalProperties": false,
103+
"required": ["position", "type"],
104+
"properties": {
105+
"position": {
106+
"description": "0-based slot index (Event_Param1 = 0).",
107+
"type": "integer",
108+
"minimum": 0
109+
},
110+
"type": { "type": "string", "minLength": 1 },
111+
"referenceKind": {
112+
"enum": [
113+
"none", "xmlObject", "modelFile", "textureFile", "audioFile", "mapFile",
114+
"boneName", "localisationKey", "enum", "HardcodedSet", "unknown"
115+
]
116+
},
117+
"referenceType": { "type": "string", "minLength": 1 },
118+
"enumName": { "type": "string", "minLength": 1 },
119+
"optional": { "type": "boolean" },
120+
"description": { "$ref": "#/$defs/localisedText" },
121+
"notes": { "$ref": "#/$defs/localisedText" }
122+
}
123+
}
124+
}
125+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://github.com/AlamoEngine-Tools/pg-starwarsgame-lsp-schema/.schemas/hardcoded-set-file.schema.json",
4+
"title": "EaW/FoC LSP schema - hardcoded reference set",
5+
"description": "Shape of eaw/hardcoded/*.yaml and foc/hardcoded/*.yaml. Mirrors YamlHardcodedSetFile/YamlHardcodedSetEntry. These are engine-fixed name sets (ability classes, behaviour modules, ...) that cannot be derived from game data.",
6+
"type": "object",
7+
"additionalProperties": false,
8+
"required": ["name", "values"],
9+
"properties": {
10+
"name": {
11+
"description": "Set name as referenced from a tag. Should match the file name.",
12+
"type": "string",
13+
"minLength": 1
14+
},
15+
"deprecated": { "type": "boolean" },
16+
"availableSince": { "type": "string", "minLength": 1 },
17+
"description": { "$ref": "#/$defs/localisedText" },
18+
"notes": { "$ref": "#/$defs/localisedText" },
19+
"values": {
20+
"type": "array",
21+
"minItems": 1,
22+
"items": { "$ref": "#/$defs/setValue" }
23+
}
24+
},
25+
"$defs": {
26+
"localisedText": {
27+
"type": "object",
28+
"minProperties": 1,
29+
"additionalProperties": { "type": "string" },
30+
"propertyNames": { "pattern": "^[a-z]{2}(-[A-Za-z]{2,4})?$" }
31+
},
32+
"setValue": {
33+
"type": "object",
34+
"additionalProperties": false,
35+
"required": ["name"],
36+
"properties": {
37+
"name": { "type": "string", "minLength": 1 },
38+
"description": { "$ref": "#/$defs/localisedText" },
39+
"notes": { "$ref": "#/$defs/localisedText" },
40+
"deprecated": { "type": "boolean" },
41+
"availableSince": { "type": "string", "minLength": 1 },
42+
"groups": {
43+
"type": "array",
44+
"items": { "type": "string", "minLength": 1 }
45+
}
46+
}
47+
}
48+
}
49+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://github.com/AlamoEngine-Tools/pg-starwarsgame-lsp-schema/.schemas/metafiles-file.schema.json",
4+
"title": "EaW/FoC LSP schema - metafile registry",
5+
"description": "Shape of eaw/meta/metafiles.yaml and foc/meta/metafiles.yaml. Mirrors YamlMetafileFile/YamlMetafileEntry. Drives file-type registration: which game files hold which object types.",
6+
"type": "object",
7+
"additionalProperties": false,
8+
"required": ["metafiles"],
9+
"properties": {
10+
"metafiles": {
11+
"type": "array",
12+
"minItems": 1,
13+
"items": { "$ref": "#/$defs/metafileEntry" }
14+
}
15+
},
16+
"$defs": {
17+
"localisedText": {
18+
"type": "object",
19+
"minProperties": 1,
20+
"additionalProperties": { "type": "string" },
21+
"propertyNames": { "pattern": "^[a-z]{2}(-[A-Za-z]{2,4})?$" }
22+
},
23+
"metafileEntry": {
24+
"type": "object",
25+
"additionalProperties": false,
26+
"required": ["path", "metaFileType"],
27+
"properties": {
28+
"path": {
29+
"description": "Game-relative path, lowercase with forward slashes (e.g. data/xml/gameobjectfiles.xml).",
30+
"type": "string",
31+
"minLength": 1,
32+
"pattern": "^[a-z0-9._/-]+$"
33+
},
34+
"metaFileType": {
35+
"description": "fileRegistry = lists other files; directContent = holds the objects itself; singleton = one well-known file; special = needs bespoke handling.",
36+
"enum": ["fileRegistry", "directContent", "singleton", "special"]
37+
},
38+
"types": {
39+
"description": "Object types the registered files contain.",
40+
"type": "array",
41+
"items": { "type": "string", "minLength": 1 }
42+
},
43+
"description": { "$ref": "#/$defs/localisedText" }
44+
}
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)