in Forge.TreeWalker/src/ForgeSchemaValidator.cs [232:264]
private static bool Validate(List<JObject> schemas, object rules, out IList<ValidationError> errorList)
{
JSchema jSchemaRules = new JSchema();
errorList = new List<ValidationError>();
if (rules is string && !string.IsNullOrWhiteSpace((string)rules))
{
jSchemaRules = JSchema.Parse((string)rules);
}
else if (rules is JSchema)
{
jSchemaRules = (JSchema)rules;
}
else
{
throw new ArgumentException("Rules argument must be a JSchema or a string that can be parsed into a JSchema.");
}
if (schemas.Count == 0)
{
return false;
}
foreach (JObject schema in schemas)
{
if (!schema.IsValid(jSchemaRules, out errorList))
{
return false;
}
}
return true;
}