Skip to content

Commit df6bcc6

Browse files
committed
schemas
1 parent 6ebc9e5 commit df6bcc6

File tree

5 files changed

+238
-113
lines changed

5 files changed

+238
-113
lines changed

YarnSpinner.Compiler/YarnProject.schema.json

Lines changed: 40 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,166 +1,93 @@
11
{
2-
"$schema": "https://json-schema.org/draft/2020-12/schema",
3-
"$id": "https://yarnspinner.dev/schemas/yarnproject.schema.json",
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://schemas.yarnspinner.dev/yarnproject.schema.json",
4+
"$comment": "Yarn Spinner project file schema, version 4.",
5+
"version": 4,
46
"title": "Yarn Spinner Project",
57
"description": "Configuration file for a Yarn Spinner project (.yarnproject)",
68
"type": "object",
79
"required": ["projectFileVersion", "sourceFiles", "baseLanguage"],
810
"properties": {
911
"projectFileVersion": {
1012
"type": "integer",
11-
"description": "The version of the project file format. Current version is 4. Versions 2 and 3 are also supported for legacy projects.",
12-
"enum": [2, 3, 4],
13+
"description": "The version of the project file format.",
14+
"minimum": 2,
1315
"default": 4
1416
},
17+
"projectName": {
18+
"type": "string",
19+
"description": "The display name of the project."
20+
},
21+
"authorName": {
22+
"type": "array",
23+
"description": "The author(s) of the project.",
24+
"items": { "type": "string" }
25+
},
1526
"sourceFiles": {
1627
"type": "array",
17-
"description": "Array of glob patterns specifying which .yarn files to include in this project.",
18-
"items": {
19-
"type": "string"
20-
},
28+
"description": "Glob patterns specifying which .yarn files to include. Relative to the .yarnproject location.",
29+
"items": { "type": "string" },
2130
"default": ["**/*.yarn"]
2231
},
2332
"excludeFiles": {
2433
"type": "array",
25-
"description": "Array of glob patterns specifying which files to exclude from the project.",
26-
"items": {
27-
"type": "string"
28-
}
29-
},
30-
"authorName": {
31-
"type": "string"
32-
},
33-
"projectName": {
34-
"type": "string"
34+
"description": "Glob patterns specifying files to exclude, even if they match sourceFiles.",
35+
"items": { "type": "string" }
3536
},
3637
"baseLanguage": {
3738
"type": "string",
39+
"description": "The language code for the source language of dialogue in .yarn files (e.g. 'en', 'ja', 'zh-Hans').",
3840
"default": "en"
3941
},
4042
"localisation": {
4143
"type": "object",
42-
"description": "Localization configuration mapping language codes to their string tables and asset directories.",
44+
"description": "Maps language codes to their string tables and asset directories for translation.",
4345
"additionalProperties": {
44-
"type": "object",
45-
"properties": {
46-
"strings": {
47-
"type": "string",
48-
"description": "Path to the CSV file containing translated strings for this language."
49-
},
50-
"assets": {
51-
"type": "string",
52-
"description": "Path to the directory containing localized assets for this language."
53-
}
46+
"type": "object",
47+
"properties": {
48+
"strings": {
49+
"type": "string",
50+
"description": "Path to the CSV file containing translated strings."
5451
},
55-
"additionalProperties": false
56-
}
52+
"assets": {
53+
"type": "string",
54+
"description": "Path to the directory containing localized assets."
55+
}
56+
},
57+
"additionalProperties": false
5758
}
5859
},
5960
"definitions": {
60-
"description": "Path(s) to .ysls.json files containing custom command and function definitions.",
61+
"description": "Path(s) to .ysls.json definition files for custom commands and functions.",
6162
"oneOf": [
62-
{
63-
"type": "string"
64-
},
65-
{
66-
"type": "array",
67-
"items": {
68-
"type": "string"
69-
}
70-
}
63+
{ "type": "string" },
64+
{ "type": "array", "items": { "type": "string" } }
7165
]
7266
},
7367
"compilerOptions": {
7468
"type": "object",
75-
"description": "Compiler configuration options.",
69+
"description": "Options that affect compilation. Used by all parts of the Yarn Spinner pipeline.",
7670
"properties": {
7771
"requireVariableDeclarations": {
7872
"type": "boolean",
73+
"description": "If true, all variables must be declared with <<declare>> before use.",
7974
"default": false
8075
},
8176
"allowPreviewFeatures": {
8277
"type": "boolean",
78+
"description": "If true, enables experimental language features that may change.",
8379
"default": false
8480
}
8581
},
8682
"additionalProperties": true
8783
},
8884
"editorOptions": {
8985
"type": "object",
90-
"description": "Editor and tooling configuration.",
86+
"description": "Editor and tooling configuration. Each editor/engine gets its own sub-object.",
9187
"properties": {
92-
"disableSpellcheck": { "type": "boolean", "default": false },
93-
"spellcheckWords": { "type": "array", "items": { "type": "string" }, "default": [] },
94-
"defaultPresenter": { "type": "string", "default": "try" },
95-
"editorCharacterColors": {
96-
"type": "array",
97-
"items": {
98-
"type": "object",
99-
"properties": {
100-
"id": { "type": "string" },
101-
"name": { "type": "string" },
102-
"colour": { "type": "string", "pattern": "^#[0-9A-Fa-f]{6}$" },
103-
"portraitPath": { "type": "string" }
104-
}
105-
}
106-
},
107-
"editorFontSize": { "type": "number", "minimum": 8, "maximum": 72 },
108-
"previewFontSize": { "type": "number", "minimum": 8, "maximum": 72 },
109-
"startNode": { "type": "string" },
110-
"projectGraphPositions": {
111-
"type": "object",
112-
"additionalProperties": {
113-
"type": "object",
114-
"properties": { "x": { "type": "number" }, "y": { "type": "number" } }
115-
}
116-
},
117-
"projectGraphColours": {
118-
"type": "object",
119-
"additionalProperties": { "type": ["string", "null"] }
120-
}
88+
"yarnScriptEditor": { "$ref": "yarnscripteditor.schema.json" }
12189
},
12290
"additionalProperties": true
123-
},
124-
"characters": {
125-
"type": "array",
126-
"description": "List of character definitions for the project.",
127-
"items": {
128-
"type": "object",
129-
"required": ["name"],
130-
"properties": {
131-
"name": {
132-
"type": "string"
133-
},
134-
"displayName": {
135-
"type": "string"
136-
},
137-
"color": {
138-
"type": "string",
139-
"pattern": "^#[0-9A-Fa-f]{6}$"
140-
},
141-
"colour": {
142-
"type": "string",
143-
"pattern": "^#[0-9A-Fa-f]{6}$"
144-
},
145-
"description": {
146-
"type": "string"
147-
},
148-
"portraitPath": {
149-
"type": "string"
150-
}
151-
},
152-
"additionalProperties": false
153-
}
154-
},
155-
"imagePath": {
156-
"type": "string",
157-
"description": "Path to a directory containing image files referenced by node 'image' headers."
158-
},
159-
"saliencyStrategy": {
160-
"type": "string",
161-
"description": "Strategy for selecting dialogue when multiple options are available.",
162-
"enum": ["first", "best", "bestLeastRecentlyViewed", "bestLeastRecentlyViewedRandom"],
163-
"default": "bestLeastRecentlyViewed"
16491
}
16592
},
16693
"additionalProperties": false
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://schemas.yarnspinner.dev/character.schema.json",
4+
"title": "Character",
5+
"description": "A character definition.",
6+
"type": "object",
7+
"required": ["name"],
8+
"properties": {
9+
"name": {
10+
"type": "string",
11+
"description": "The name of the character as it appears before the colon in dialogue lines (e.g. 'Sally', 'Guard')."
12+
},
13+
"displayName": {
14+
"type": "string",
15+
"description": "The name shown to players in the game UI. Defaults to name if not set."
16+
},
17+
"colour": { "$ref": "colour.schema.json" },
18+
"description": {
19+
"type": "string",
20+
"description": "Notes about this character for documentation purposes."
21+
},
22+
"portraitPath": {
23+
"type": "string",
24+
"description": "Path to this character's portrait image file, relative to the .yarnproject."
25+
}
26+
},
27+
"additionalProperties": false
28+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://schemas.yarnspinner.dev/colour.schema.json",
4+
"title": "Colour",
5+
"description": "A hex colour code (e.g. #FF5733).",
6+
"type": "string",
7+
"pattern": "^#[0-9A-Fa-f]{6}$"
8+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://yarnspinner.dev/schemas/yarnproject.schema.json",
4+
"$comment": "Yarn Spinner project file schema, version 3.",
5+
"version": 3,
6+
"title": "Yarn Spinner Project",
7+
"description": "Configuration file for a Yarn Spinner project (.yarnproject)",
8+
"type": "object",
9+
"required": [
10+
"projectFileVersion",
11+
"sourceFiles",
12+
"baseLanguage"
13+
],
14+
"properties": {
15+
"projectFileVersion": {
16+
"type": "integer",
17+
"description": "The version of the project file format.",
18+
"minimum": 2,
19+
"default": 3
20+
},
21+
"sourceFiles": {
22+
"type": "array",
23+
"description": "Glob patterns specifying which .yarn files to include. Relative to the .yarnproject location.",
24+
"items": {
25+
"type": "string"
26+
},
27+
"default": [
28+
"**/*.yarn"
29+
]
30+
},
31+
"excludeFiles": {
32+
"type": "array",
33+
"description": "Glob patterns specifying files to exclude, even if they match sourceFiles.",
34+
"items": {
35+
"type": "string"
36+
}
37+
},
38+
"baseLanguage": {
39+
"type": "string",
40+
"description": "The language code for the source language of dialogue in .yarn files (e.g. 'en', 'ja', 'zh-Hans').",
41+
"default": "en"
42+
},
43+
"localisation": {
44+
"type": "object",
45+
"description": "Maps language codes to their string tables and asset directories for translation.",
46+
"additionalProperties": {
47+
"type": "object",
48+
"properties": {
49+
"strings": {
50+
"type": "string",
51+
"description": "Path to the CSV file containing translated strings."
52+
},
53+
"assets": {
54+
"type": "string",
55+
"description": "Path to the directory containing localized assets."
56+
}
57+
},
58+
"additionalProperties": false
59+
}
60+
},
61+
"definitions": {
62+
"description": "Path(s) to .ysls.json definition files for custom commands and functions.",
63+
"type": "string"
64+
},
65+
"compilerOptions": {
66+
"type": "object",
67+
"description": "Options that affect compilation. Used by all parts of the Yarn Spinner pipeline.",
68+
"properties": {
69+
"allowPreviewFeatures": {
70+
"type": "boolean",
71+
"description": "If true, enables experimental language features that may change.",
72+
"default": false
73+
},
74+
"yarnScriptEditor": {
75+
"$ref": "yarnscripteditor.schema.json"
76+
}
77+
},
78+
"additionalProperties": true
79+
}
80+
},
81+
"additionalProperties": true
82+
}

0 commit comments

Comments
 (0)