summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-08-05 23:30:11 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-09-14 19:05:45 -0400
commit3331beb17a7bda439b281e7507ae187c68b6359c (patch)
treeed6a231f79871bfd1a94d1025cd0388857851b5c
parent39d58a68ab06328cbf7086900ac8c4f2c91db360 (diff)
downloadSMAPI-3331beb17a7bda439b281e7507ae187c68b6359c.tar.gz
SMAPI-3331beb17a7bda439b281e7507ae187c68b6359c.tar.bz2
SMAPI-3331beb17a7bda439b281e7507ae187c68b6359c.zip
integrate Content Patcher schema into validator, update docs (#654)
-rw-r--r--docs/release-notes.md1
-rw-r--r--docs/technical/web.md1
-rw-r--r--src/SMAPI.Web/Controllers/JsonValidatorController.cs3
-rw-r--r--src/SMAPI.Web/wwwroot/schemas/content-patcher.json33
4 files changed, 21 insertions, 17 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index 9ec33000..9ce88db1 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -39,6 +39,7 @@ These changes have not been released yet.
* For the JSON validator:
* Added JSON validator at [json.smapi.io](https://json.smapi.io), which lets you validate a JSON file against predefined mod formats.
* Added support for the `manifest.json` format.
+ * Added support for Content Patcher's `content.json` format (thanks to TehPers!).
* For modders:
* Mods are now loaded much earlier in the game launch. This lets mods intercept any content asset, but the game is not fully initialised when `Entry` is called (use the `GameLaunched` event if you need to run code when the game is initialised).
diff --git a/docs/technical/web.md b/docs/technical/web.md
index 0d2039d8..a008fe72 100644
--- a/docs/technical/web.md
+++ b/docs/technical/web.md
@@ -60,6 +60,7 @@ Current schemas:
format | schema URL
------ | ----------
[SMAPI `manifest.json`](https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Manifest) | https://smapi.io/schemas/manifest.json
+[Content Patcher `content.json`](https://github.com/Pathoschild/StardewMods/tree/develop/ContentPatcher#readme) | https://smapi.io/schemas/content-patcher.json
### Web API
SMAPI provides a web API at `api.smapi.io` for use by SMAPI and external tools. The URL includes a
diff --git a/src/SMAPI.Web/Controllers/JsonValidatorController.cs b/src/SMAPI.Web/Controllers/JsonValidatorController.cs
index 41c07cee..9ded9c0d 100644
--- a/src/SMAPI.Web/Controllers/JsonValidatorController.cs
+++ b/src/SMAPI.Web/Controllers/JsonValidatorController.cs
@@ -39,7 +39,8 @@ namespace StardewModdingAPI.Web.Controllers
private readonly IDictionary<string, string> SchemaFormats = new Dictionary<string, string>
{
["none"] = "None",
- ["manifest"] = "Manifest"
+ ["manifest"] = "Manifest",
+ ["content-patcher"] = "Content Patcher"
};
/// <summary>The schema ID to use if none was specified.</summary>
diff --git a/src/SMAPI.Web/wwwroot/schemas/content-patcher.json b/src/SMAPI.Web/wwwroot/schemas/content-patcher.json
index e5810871..8dae5a98 100644
--- a/src/SMAPI.Web/wwwroot/schemas/content-patcher.json
+++ b/src/SMAPI.Web/wwwroot/schemas/content-patcher.json
@@ -3,6 +3,7 @@
"$id": "https://smapi.io/schemas/content-patcher.json",
"title": "Content Patcher content pack",
"description": "Content Patcher content file for mods",
+ "@documentationUrl": "https://github.com/Pathoschild/StardewMods/tree/develop/ContentPatcher#readme",
"type": "object",
"definitions": {
"Version": {
@@ -15,7 +16,7 @@
"title": "Action",
"description": "The kind of change to make.",
"type": "string",
- "enum": ["Load", "EditImage", "EditData", "EditMap"]
+ "enum": [ "Load", "EditImage", "EditData", "EditMap" ]
},
"Target": {
"title": "Target asset",
@@ -33,7 +34,7 @@
"anyOf": [
{
"type": "string",
- "enum": ["true", "false"]
+ "enum": [ "true", "false" ]
},
{
"type": "string",
@@ -47,7 +48,7 @@
"$ref": "#/definitions/Condition"
}
},
- "required": ["Action", "Target"],
+ "required": [ "Action", "Target" ],
"allOf": [
{
"if": {
@@ -105,7 +106,7 @@
"$ref": "#/definitions/FromFile"
}
},
- "required": ["FromFile"]
+ "required": [ "FromFile" ]
},
"EditImageChange": {
"properties": {
@@ -126,10 +127,10 @@
"title": "Patch mode",
"description": "How to apply FromArea to ToArea. Defaults to Replace.",
"type": "string",
- "enum": ["Replace", "Overlay"]
+ "enum": [ "Replace", "Overlay" ]
}
},
- "required": ["FromFile"]
+ "required": [ "FromFile" ]
},
"EditDataChange": {
"properties": {
@@ -166,7 +167,7 @@
"type": "string"
}
},
- "required": ["ID", "BeforeID"],
+ "required": [ "ID", "BeforeID" ],
"additionalProperties": false
},
{
@@ -178,7 +179,7 @@
"type": "string"
}
},
- "required": ["ID", "AfterID"],
+ "required": [ "ID", "AfterID" ],
"additionalProperties": false
},
{
@@ -187,14 +188,14 @@
"ToPosition": {
"title": "To position",
"description": "Move entry so it's right at this position",
- "enum": ["Top", "Bottom"]
+ "enum": [ "Top", "Bottom" ]
}
},
- "required": ["ID", "ToPosition"],
+ "required": [ "ID", "ToPosition" ],
"additionalProperties": false
}
],
- "required": ["ID"]
+ "required": [ "ID" ]
}
}
}
@@ -216,7 +217,7 @@
"$ref": "#/definitions/Rectangle"
}
},
- "required": ["FromFile", "ToArea"]
+ "required": [ "FromFile", "ToArea" ]
},
"Config": {
"type": "object",
@@ -250,10 +251,10 @@
"const": false
}
},
- "required": ["AllowBlank"]
+ "required": [ "AllowBlank" ]
},
"then": {
- "required": ["Default"]
+ "required": [ "Default" ]
}
}
},
@@ -282,7 +283,7 @@
"$ref": "#/definitions/Condition"
}
},
- "required": ["Name", "Value"]
+ "required": [ "Name", "Value" ]
},
"FromFile": {
"title": "Source file",
@@ -354,5 +355,5 @@
"format": "uri"
}
},
- "required": ["Format", "Changes"]
+ "required": [ "Format", "Changes" ]
}