summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs
blob: 4d37d449202a3fe92b2d3eb3715605ac27e200a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using Newtonsoft.Json.Schema;

namespace StardewModdingAPI.Web.ViewModels.JsonValidator
{
    /// <summary>The view model for a JSON validator error.</summary>
    public class JsonValidatorErrorModel
    {
        /*********
        ** Accessors
        *********/
        /// <summary>The line number on which the error occurred.</summary>
        public int Line { get; }

        /// <summary>The field path in the JSON file where the error occurred.</summary>
        public string? Path { get; }

        /// <summary>A human-readable description of the error.</summary>
        public string Message { get; }

        /// <summary>The schema error type.</summary>
        public ErrorType SchemaErrorType { get; }


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="line">The line number on which the error occurred.</param>
        /// <param name="path">The field path in the JSON file where the error occurred.</param>
        /// <param name="message">A human-readable description of the error.</param>
        /// <param name="schemaErrorType">The schema error type.</param>
        public JsonValidatorErrorModel(int line, string? path, string message, ErrorType schemaErrorType)
        {
            this.Line = line;
            this.Path = path;
            this.Message = message;
            this.SchemaErrorType = schemaErrorType;
        }
    }
}