private string GetValidationError(string propertyName, DataSet dataSet) { string error = null; switch (propertyName) { case "Name": var nameValidationResult = new DatasetNameValidationRule().Validate(dataSet.Name, CultureInfo.CurrentCulture); error = nameValidationResult.IsValid ? null : nameValidationResult.ErrorContent.ToString(); break; case "NgramCount": var ngramValidationResult = new NgramCountValidationRule().Validate(dataSet.NGramCount, CultureInfo.CurrentCulture); error = ngramValidationResult.IsValid ? null : ngramValidationResult.ErrorContent.ToString(); break; case "SampleDocument": var sampleDocValidationResult = new JsonValidationRule().Validate(SampleDocument, CultureInfo.CurrentCulture); error = sampleDocValidationResult.IsValid ? null : sampleDocValidationResult.ErrorContent.ToString(); break; case "DocumentSchema": var docSchemaValidationResult = new JsonValidationRule().Validate(DocumentSchema, CultureInfo.CurrentCulture); error = docSchemaValidationResult.IsValid ? null : docSchemaValidationResult.ErrorContent.ToString(); break; default: error = null; throw new Exception("Unexpected property being validated on Service"); } return(error); }
public JsonValidationError(JsonValidationRule rule, JsonValidationErrorKind kind) { Rule = rule; Kind = kind; }