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.90 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.89 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.88 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.87 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.86 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.85 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.84 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.83 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.82 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.81 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.80 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.79 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.78 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.77 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.76 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.75 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.74 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.73 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.72 tracks/csharp/generators/Input/CanonicalDataParser.cs
trackler-2.2.1.71 tracks/csharp/generators/Input/CanonicalDataParser.cs