From ed337ab9644527465205547bd7e319194df553ab Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 30 Apr 2022 12:33:33 -0400 Subject: [PATCH] fix model binding for mod update-check API --- .../Framework/Clients/WebApi/ModSearchModel.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs index a0cd9d4d..d1b7fa4d 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs @@ -1,3 +1,4 @@ +using System; using System.Linq; using StardewModdingAPI.Toolkit.Utilities; @@ -28,6 +29,15 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi /********* ** Public methods *********/ + /// Construct an empty instance. + [Obsolete("This constructor only exists to support ASP.NET model binding, and shouldn't be used directly.")] + public ModSearchModel() + { + // ASP.NET Web API needs a public empty constructor for top-level request models, and + // it'll fail if the other constructor is marked with [JsonConstructor]. Apparently + // it's fine with non-empty constructors in nested models like ModSearchEntryModel. + } + /// Construct an instance. /// The mods to search. /// The SMAPI version installed by the player. If this is null, the API won't provide a recommended update.