From c785572fdd07df17487fedd67551cb9e5ff60a2d Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 5 Aug 2019 00:48:52 -0400 Subject: raise JSON validation error for duplicate fields (#654) --- src/SMAPI.Web/Controllers/JsonValidatorController.cs | 5 ++++- src/SMAPI.Web/wwwroot/schemas/manifest.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/SMAPI.Web/Controllers/JsonValidatorController.cs b/src/SMAPI.Web/Controllers/JsonValidatorController.cs index b69a1006..41c07cee 100644 --- a/src/SMAPI.Web/Controllers/JsonValidatorController.cs +++ b/src/SMAPI.Web/Controllers/JsonValidatorController.cs @@ -91,7 +91,10 @@ namespace StardewModdingAPI.Web.Controllers JToken parsed; try { - parsed = JToken.Parse(paste.Content); + parsed = JToken.Parse(paste.Content, new JsonLoadSettings + { + DuplicatePropertyNameHandling = DuplicatePropertyNameHandling.Error + }); } catch (JsonReaderException ex) { diff --git a/src/SMAPI.Web/wwwroot/schemas/manifest.json b/src/SMAPI.Web/wwwroot/schemas/manifest.json index 41d1ec2d..d4727eda 100644 --- a/src/SMAPI.Web/wwwroot/schemas/manifest.json +++ b/src/SMAPI.Web/wwwroot/schemas/manifest.json @@ -134,6 +134,6 @@ "additionalProperties": false, "@errorMessages": { "oneOf:valid against no schemas": "Missing required field: EntryDll or ContentPackFor.", - "oneOf:valid against more than one schema": "Can't specify both EntryDll or ContentPackFor, they're mutually exclusive." + "oneOf:valid against more than one schema": "Can't specify both EntryDll and ContentPackFor, they're mutually exclusive." } } -- cgit