|
| 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 | +} |
0 commit comments