/// <summary> /// Validates a <see cref="JsonValue"/> against the schema. /// </summary> /// <param name="json">A <see cref="JsonValue"/></param> /// <param name="root">The root schema serialized to a <see cref="JsonValue"/>. Used internally for resolving references.</param> /// <returns>True if the <see cref="JsonValue"/> passes validation; otherwise false.</returns> public SchemaValidationResults Validate(JsonValue json, JsonValue root = null) { var jValue = root ?? ToJson(null); if (Resolved == null || root == null) { jValue = _Resolve(jValue); } var refResults = Resolved?.Validate(json, jValue) ?? new SchemaValidationResults(null, "Error finding referenced schema."); return(new SchemaValidationResults(new[] { refResults })); }