public bool Parse(IFileSystemAccessor fs, string key, JsonNode value) { switch (key) { case "maxProperties": MaxProperties = value.GetInt32(); return(true); case "minProperties": MinProperties = value.GetInt32(); return(true); case "required": { foreach (var req in value.ArrayItems) { m_required.Add(req.GetString()); } } return(true); case "properties": { foreach (var prop in value.ObjectItems) { AddProperty(fs, prop.Key, prop.Value); } } return(true); case "patternProperties": PatternProperties = value.GetString(); return(true); case "additionalProperties": { var sub = new JsonSchema(); sub.Parse(fs, value, "additionalProperties"); AdditionalProperties = sub; } return(true); case "dependencies": { foreach (var kv in value.ObjectItems) { Dependencies.Add(kv.Key, kv.Value.ArrayItems.Select(x => x.GetString()).ToArray()); } } return(true); case "propertyNames": return(true); } return(false); }
public bool Parse(IFileSystemAccessor fs, string key, JsonNode value) { switch (key) { case "maxLength": MaxLength = value.GetInt32(); return(true); case "minLength": MinLength = value.GetInt32(); return(true); case "pattern": Pattern = new Regex(value.GetString().Replace("\\\\", "\\")); return(true); } return(false); }