@using Humanizer @using StardewModdingAPI.Web.Framework @using StardewModdingAPI.Web.ViewModels.JsonValidator @model JsonValidatorModel @{ // get view data string curPageUrl = this.Url.PlainAction("Index", "JsonValidator", new { schemaName = Model.SchemaName, id = Model.PasteID }, absoluteUrl: true); string newUploadUrl = this.Url.PlainAction("Index", "JsonValidator", new { schemaName = Model.SchemaName }); string schemaDisplayName = null; bool isValidSchema = Model.SchemaName != null && Model.SchemaFormats.TryGetValue(Model.SchemaName, out schemaDisplayName) && schemaDisplayName?.ToLower() != "none"; bool isEditView = Model.Content == null || Model.SchemaName?.ToLower() == "edit"; // build title ViewData["Title"] = "JSON validator"; @if (Model.PasteID != null) { ViewData["ViewTitle"] = ViewData["Title"]; ViewData["Title"] += " (" + string.Join(", ", new[] { isValidSchema ? schemaDisplayName : null, Model.PasteID }.Where(p => p != null)) + ")"; } } @section Head { @if (Model.PasteID != null) { } } @* upload result banner *@ @if (Model.UploadError != null) { } else if (Model.ParseError != null) { } else if (!isEditView && Model.PasteID != null) { } @* save warnings *@ @if (Model.UploadWarning != null || Model.Expiry != null) {
@if (Model.Expiry != null) { This JSON file will expire in @((DateTime.UtcNow - Model.Expiry.Value).Humanize()). }
} @* upload new file *@ @if (isEditView) {

Upload a JSON file

  1. Choose the JSON format:
  2. Drag the file onto this textbox (or paste the text in):
  3. Click this button:
} @* validation results *@ @if (!isEditView) {
@if (Model.UploadError == null) {

Validation

@(Model.Errors.Any() ? "Oops, found some issues with your JSON." : "No errors found!") @if (!isValidSchema) { (You have no schema selected, so only the basic JSON syntax was checked.) } else if (Model.FormatUrl != null) { See format documentation for more info. }

@if (Model.Errors.Any()) { @foreach (JsonValidatorErrorModel error in Model.Errors) { }
Line Field Error
@error.Line @error.Path @error.Message
} }

Content

You can change JSON format () or edit this file.
@Model.Content
@if (isValidSchema) { }
}