From e54a5d05692f2f5ae852dbd3ed0a247920591418 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 3 Aug 2020 22:35:51 -0400 Subject: update Content Patcher schema for 1.16 --- src/SMAPI.Web/wwwroot/schemas/content-patcher.json | 85 ++++++++++++++++++---- 1 file changed, 70 insertions(+), 15 deletions(-) (limited to 'src/SMAPI.Web/wwwroot') diff --git a/src/SMAPI.Web/wwwroot/schemas/content-patcher.json b/src/SMAPI.Web/wwwroot/schemas/content-patcher.json index 6e8a4e52..f2c06825 100644 --- a/src/SMAPI.Web/wwwroot/schemas/content-patcher.json +++ b/src/SMAPI.Web/wwwroot/schemas/content-patcher.json @@ -11,9 +11,9 @@ "title": "Format version", "description": "The format version. You should always use the latest version to enable the latest features and avoid obsolete behavior.", "type": "string", - "const": "1.15.0", + "const": "1.16.0", "@errorMessages": { - "const": "Incorrect value '@value'. This should be set to the latest format version, currently '1.15.0'." + "const": "Incorrect value '@value'. This should be set to the latest format version, currently '1.16.0'." } }, "ConfigSchema": { @@ -102,7 +102,7 @@ "title": "Action", "description": "The kind of change to make.", "type": "string", - "enum": [ "Load", "EditImage", "EditData", "EditMap" ] + "enum": [ "Load", "EditImage", "EditData", "EditMap", "Include" ] }, "Target": { "title": "Target asset", @@ -327,9 +327,16 @@ } }, "then": { - "required": [ "FromFile" ], + "required": [ "FromFile", "Target" ], "propertyNames": { - "enum": [ "Action", "Target", "LogName", "Enabled", "When", "FromFile" ] + "enum": [ + "Action", + "Enabled", + "FromFile", + "LogName", + "Target", + "When" + ] } } }, @@ -340,9 +347,20 @@ } }, "then": { - "required": [ "FromFile" ], + "required": [ "FromFile", "Target" ], "propertyNames": { - "enum": [ "Action", "Target", "LogName", "Enabled", "When", "FromFile", "FromArea", "ToArea", "PatchMode" ] + "enum": [ + "Action", + "Enabled", + "FromFile", + "LogName", + "Target", + "When", + + "FromArea", + "PatchMode", + "ToArea" + ] } } }, @@ -354,7 +372,18 @@ }, "then": { "propertyNames": { - "enum": [ "Action", "Target", "LogName", "Enabled", "When", "FromFile", "Fields", "Entries", "MoveEntries" ] + "enum": [ + "Action", + "Enabled", + "FromFile", + "LogName", + "Target", + "When", + + "Entries", + "Fields", + "MoveEntries" + ] } } }, @@ -377,16 +406,42 @@ } }, "propertyNames": { - "enum": [ "Action", "Target", "LogName", "Enabled", "When", "FromFile", "FromArea", "ToArea", "MapProperties", "MapTiles" ] + "enum": [ + "Action", + "Enabled", + "FromFile", + "LogName", + "Target", + "When", + + "FromArea", + "MapProperties", + "MapTiles", + "ToArea" + ] + } + } + }, + { + "if": { + "properties": { + "Action": { "const": "Include" } + } + }, + "then": { + "required": [ "FromFile" ], + "propertyNames": { + "enum": [ + "Action", + "Enabled", + "FromFile", + "LogName", + "When" + ] } } } - ], - - "required": [ "Action", "Target" ], - "@errorMessages": { - "allOf": "$transparent" - } + ] } }, "$schema": { -- cgit From d6dc1364bed4eb93bb8d376f9c1dec364ab82881 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 16 Aug 2020 11:28:13 -0400 Subject: update schema for Content Patcher 1.17 --- docs/release-notes.md | 2 +- src/SMAPI.Web/wwwroot/schemas/content-patcher.json | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/SMAPI.Web/wwwroot') diff --git a/docs/release-notes.md b/docs/release-notes.md index 5735e388..e6679a5e 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -18,7 +18,7 @@ * You can now read/write `SDate` values to JSON (e.g. for `config.json`, network mod messages, etc). * For the web UI: - * Updated the JSON validator/schema for Content Patcher 1.16. + * Updated the JSON validator/schema for Content Patcher 1.16 and 1.17. * For SMAPI developers: * The web API now returns an update alert in two new cases: any newer unofficial update (previously only shown if the mod was incompatible), and a newer prerelease version if the installed non-prerelease version is broken (previously only shown if the installed version was prerelease). diff --git a/src/SMAPI.Web/wwwroot/schemas/content-patcher.json b/src/SMAPI.Web/wwwroot/schemas/content-patcher.json index f2c06825..a854e16f 100644 --- a/src/SMAPI.Web/wwwroot/schemas/content-patcher.json +++ b/src/SMAPI.Web/wwwroot/schemas/content-patcher.json @@ -11,9 +11,9 @@ "title": "Format version", "description": "The format version. You should always use the latest version to enable the latest features and avoid obsolete behavior.", "type": "string", - "const": "1.16.0", + "const": "1.17.0", "@errorMessages": { - "const": "Incorrect value '@value'. This should be set to the latest format version, currently '1.16.0'." + "const": "Incorrect value '@value'. This should be set to the latest format version, currently '1.17.0'." } }, "ConfigSchema": { @@ -124,6 +124,9 @@ "title": "Enabled", "description": "Whether to apply this patch. Default true. This fields supports immutable tokens (e.g. config tokens) if they return true/false.", "anyOf": [ + { + "type": "boolean" + }, { "type": "string", "enum": [ "true", "false" ] @@ -131,15 +134,18 @@ { "type": "string", "pattern": "\\{\\{[^{}]+\\}\\}" - }, - { - "type": "boolean" } ], "@errorMessages": { "anyOf": "Invalid value; must be true, false, or a single token which evaluates to true or false." } }, + "Update": { + "title": "Update", + "description": "When the patch should update if it changed. The possible values are 'OnDayStart' and 'OnLocationChange' (defaults to OnDayStart).", + "type": "string", + "enum": [ "OnDayStart", "OnLocationChange" ] + }, "FromFile": { "title": "Source file", "description": "The relative file path in your content pack folder to load instead (like 'assets/dinosaur.png'). This can be a .json (data), .png (image), .tbin or .tmx (map), or .xnb file. This field supports tokens and capitalization doesn't matter.", -- cgit From 6afb80676becc337f7c381d71171d36c53e219ee Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 16 Aug 2020 23:01:19 -0400 Subject: fix CP validation for new 'Update' field --- src/SMAPI.Web/wwwroot/schemas/content-patcher.json | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/SMAPI.Web/wwwroot') diff --git a/src/SMAPI.Web/wwwroot/schemas/content-patcher.json b/src/SMAPI.Web/wwwroot/schemas/content-patcher.json index a854e16f..3fd24e4e 100644 --- a/src/SMAPI.Web/wwwroot/schemas/content-patcher.json +++ b/src/SMAPI.Web/wwwroot/schemas/content-patcher.json @@ -341,6 +341,7 @@ "FromFile", "LogName", "Target", + "Update", "When" ] } @@ -361,6 +362,7 @@ "FromFile", "LogName", "Target", + "Update", "When", "FromArea", @@ -384,6 +386,7 @@ "FromFile", "LogName", "Target", + "Update", "When", "Entries", @@ -418,6 +421,7 @@ "FromFile", "LogName", "Target", + "Update", "When", "FromArea", @@ -442,6 +446,7 @@ "Enabled", "FromFile", "LogName", + "Update", "When" ] } -- cgit