fix model binding error
This commit is contained in:
parent
7b79703de6
commit
b25e30a896
|
@ -122,7 +122,7 @@ namespace StardewModdingAPI.Web.Controllers
|
|||
FileInfo? schemaFile = this.FindSchemaFile(schemaName);
|
||||
if (schemaFile == null)
|
||||
return this.View("Index", result.SetParseError($"Invalid schema '{schemaName}'."));
|
||||
schema = JSchema.Parse(System.IO.File.ReadAllText(schemaFile.FullName));
|
||||
schema = JSchema.Parse(await System.IO.File.ReadAllTextAsync(schemaFile.FullName));
|
||||
}
|
||||
|
||||
// get format doc URL
|
||||
|
@ -151,7 +151,7 @@ namespace StardewModdingAPI.Web.Controllers
|
|||
string schemaName = this.NormalizeSchemaName(request.SchemaName);
|
||||
|
||||
// get raw text
|
||||
string input = request.Content;
|
||||
string? input = request.Content;
|
||||
if (string.IsNullOrWhiteSpace(input))
|
||||
return this.View("Index", this.GetModel(null, schemaName, isEditView: true).SetUploadError("The JSON file seems to be empty."));
|
||||
|
||||
|
|
|
@ -7,22 +7,9 @@ namespace StardewModdingAPI.Web.ViewModels.JsonValidator
|
|||
** Accessors
|
||||
*********/
|
||||
/// <summary>The schema name with which to validate the JSON.</summary>
|
||||
public string SchemaName { get; }
|
||||
public string? SchemaName { get; set; }
|
||||
|
||||
/// <summary>The raw content to validate.</summary>
|
||||
public string Content { get; }
|
||||
|
||||
|
||||
/*********
|
||||
** Accessors
|
||||
*********/
|
||||
/// <summary>Construct an instance.</summary>
|
||||
/// <param name="schemaName">The schema name with which to validate the JSON.</param>
|
||||
/// <param name="content">The raw content to validate.</param>
|
||||
public JsonValidatorRequestModel(string schemaName, string content)
|
||||
{
|
||||
this.SchemaName = schemaName;
|
||||
this.Content = content;
|
||||
}
|
||||
public string? Content { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue