Sha256: 8d406e9a636a5c7f8c2ed183ba5d8f04f88b0fb3900fc4e5f7dd80cac9170116

Contents?: true

Size: 751 Bytes

Versions: 86

Compression:

Stored size: 751 Bytes

Contents

using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;

namespace Generators.Input
{
    public class CanonicalDataParser
    {
        private readonly CanonicalDataFile _canonicalDataFile;

        public CanonicalDataParser(CanonicalDataFile canonicalDataFile)
        {
            _canonicalDataFile = canonicalDataFile;
        }
        
        public CanonicalData Parse(string exercise)
        {
            var canonicalDataJson = _canonicalDataFile.Contents(exercise);
            var canonicalData = JsonConvert.DeserializeObject<CanonicalData>(canonicalDataJson);
            
            Validator.ValidateObject(canonicalData, new ValidationContext(canonicalData));

            return canonicalData;
        }
    }
}

Version data entries

86 entries across 86 versions & 1 rubygems

Version Path
trackler-2.2.1.151 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.150 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.149 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.148 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.147 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.146 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.145 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.144 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.143 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.142 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.141 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.140 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.139 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.138 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.137 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.136 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.135 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.134 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.133 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.132 tracks/csharp/generators/Input/CanonicalDataParser.cs