/// <summary> /// Add a single property requirement to the <code>properties</code> keyword. /// </summary> public static JsonSchema Property(this JsonSchema schema, string name, JsonSchema property) { var keyword = schema.OfType <PropertiesKeyword>().FirstOrDefault(); if (keyword == null) { keyword = new PropertiesKeyword(); schema.Add(keyword); } keyword.Add(name, property); return(schema); }
/// <summary>Indicates whether the current object is equal to another object of the same type.</summary> /// <returns>true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.</returns> /// <param name="other">An object to compare with this object.</param> public bool Equals(PropertiesKeyword other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } var propertiesMatch = this.LeftOuterJoin(other, tk => tk.Key, ok => ok.Key, (tk, ok) => new { ThisProperty = tk.Value, OtherProperty = ok.Value }) .ToList(); return(propertiesMatch.All(k => Equals(k.ThisProperty, k.OtherProperty))); }