update Content Patcher schema for 2.5.0 and improve validation

This commit is contained in:
Jesse Plamondon-Willard
2025-01-17 18:28:42 -05:00
parent 98fb2847b8
commit 6103cc2239
2 changed files with 43 additions and 9 deletions
+4
View File
@@ -10,6 +10,10 @@
* For the web UI:
* Fixed search engines able to index uploaded logs and JSON files via the raw download option.
* Improved Content Patcher JSON schema:
* Updated for Content Patcher 2.5.0.
* Added format validation for token names.
* Fixed incorrect error when setting a config default to a boolean or number.
## 4.1.10
Released 18 December 2024 for Stardew Valley 1.6.14 or later.
@@ -14,15 +14,21 @@
"title": "Format version",
"description": "The format version. You should always use the latest version to enable the latest features, avoid obsolete behavior, and reduce load times.",
"type": "string",
"pattern": "^2\\.4\\.[0-9]+$",
"pattern": "^2\\.5\\.[0-9]+$",
"@errorMessages": {
"pattern": "Incorrect value '@value'. You should always use the latest format version (currently 2.4.0) to enable the latest features, avoid obsolete behavior, and reduce load times."
"pattern": "Incorrect value '@value'. You should always use the latest format version (currently 2.5.0) to enable the latest features, avoid obsolete behavior, and reduce load times."
}
},
"ConfigSchema": {
"title": "Config schema",
"description": "Defines the config.json format, to support more complex mods.",
"type": "object",
"propertyNames": {
"pattern": "^[^\\{\\}\\[\\]\\(\\)\\.\\-]+$",
"@errorMessages": {
"pattern": "The token name should be alphanumeric with no special characters."
}
},
"additionalProperties": {
"type": "object",
"properties": {
@@ -44,7 +50,7 @@
"Default": {
"title": "Default value",
"description": "The default values when the field is missing. Can contain multiple comma-delimited values if AllowMultiple is true. If omitted, blank fields are left blank.",
"type": "string"
"type": [ "boolean", "number", "string" ]
},
"Description": {
"title": "Description",
@@ -142,7 +148,11 @@
"Name": {
"title": "Name",
"description": "The name of the token to use for tokens & conditions.",
"type": "string"
"type": "string",
"pattern": "^[^\\{\\}\\[\\]\\(\\)\\.\\-]+$",
"@errorMessages": {
"pattern": "The token name should be alphanumeric with no special characters."
}
},
"Value": {
"title": "Token value",
@@ -152,7 +162,7 @@
"When": {
"title": "When",
"description": "Only set the value if the given conditions match. If not specified, always matches.",
"$ref": "#/definitions/Condition"
"$ref": "#/definitions/Conditions"
}
},
@@ -214,6 +224,11 @@
"pattern": "Invalid value; must be 'OnDayStart', 'OnLocationChange', 'OnTimeChange', or a comma-delimited combination of those values."
}
},
"LocalTokens": {
"title": "Local tokens",
"description": "Tokens to define for this specific patch, and (for an Include patch) the patches it includes.\n\nLimitation: local tokens defined directly on a patch can't be used in the `FromFile` and `Target` fields (since they can use tokens like `{{FromFile}}`). However, local tokens inherited from a parent Include patch can be used in those fields too.",
"$ref": "#/definitions/LocalTokens"
},
"FromFile": {
"title": "Source file",
"description": "The relative file path in your content pack folder to load instead (like 'assets/dinosaur.png'), or multiple comma-delimited values. This can be a .fnt (font), .json (data), .png (image), .tbin or .tmx (map), or .xnb file. This field supports tokens and capitalization doesn't matter.",
@@ -397,7 +412,7 @@
"When": {
"title": "When",
"description": "Only apply the patch if the given conditions match.",
"$ref": "#/definitions/Condition"
"$ref": "#/definitions/Conditions"
}
},
"allOf": [
@@ -423,6 +438,7 @@
"enum": [
"Action",
"FromFile",
"LocalTokens",
"LogName",
"Target",
"Update",
@@ -458,6 +474,7 @@
"enum": [
"Action",
"FromFile",
"LocalTokens",
"LogName",
"Target",
"Update",
@@ -487,6 +504,7 @@
"propertyNames": {
"enum": [
"Action",
"LocalTokens",
"LogName",
"Target",
"Update",
@@ -535,6 +553,7 @@
"enum": [
"Action",
"FromFile",
"LocalTokens",
"LogName",
"Target",
"Update",
@@ -564,6 +583,7 @@
"enum": [
"Action",
"FromFile",
"LocalTokens",
"LogName",
"Update",
"When"
@@ -586,12 +606,24 @@
}
},
"definitions": {
"Condition": {
"Conditions": {
"type": "object",
"additionalProperties": {
"type": [ "boolean", "integer", "string" ]
}
},
"LocalTokens": {
"type": "object",
"propertyNames": {
"pattern": "^[^\\{\\}\\[\\]\\(\\)\\.\\-]+$",
"@errorMessages": {
"pattern": "The token name should be alphanumeric with no special characters."
}
},
"additionalProperties": {
"type": [ "boolean", "integer", "string" ]
}
},
"Position": {
"type": "object",
"properties": {
@@ -644,7 +676,6 @@
"required": [ "X", "Y", "Width", "Height" ],
"additionalProperties": false
},
"EditPriority": {
"title": "Edit priority",
"description": "When multiple patches or mods edit the same asset, the order in which they should be applied. Defaults to 'Default'. The patches for an asset are applied in this order: (1) by earliest to latest priority; (2) then by mod load order, e.g. based on dependencies; (3) then by the order of patches in content.json.",
@@ -663,7 +694,6 @@
"oneOf": "The edit priority must be 'Early', 'Default', 'Late', or a numeric offset like 'Early + 5'."
}
},
"LoadPriority": {
"title": "Load priority",
"description": "When multiple patches or mods load the same asset, the priority which decides which one is applied. Defaults to 'Exclusive'. If set to Low/Medium/High, the highest-priority patch is applied (or the first one by load order + patch order is multiple patches have the highest priority). If set to Exclusive, it's applied if only one patch has that priority, else no exclusive patches are applied. Avoid using Exclusive when possible, since it significantly reduces mod compatibility.",