summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs
blob: 3c63b730db60511d870188300c112723716605a0 (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
41
42
43
44
45
#nullable disable

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; set; }

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

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

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


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        public JsonValidatorErrorModel() { }

        /// <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;
        }
    }
}