예제 #1
0
 /// <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(PatternPropertiesKeyword other)
 {
     if (other is null)
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(this.ContentsEqual(other));
 }
        /// <summary>
        /// Add a single pattern-based property requirement to the <code>patterProperties</code> keyword.
        /// </summary>
        public static JsonSchema PatternProperty(this JsonSchema schema, [RegexPattern] string name, JsonSchema property)
        {
            var keyword = schema.OfType <PatternPropertiesKeyword>().FirstOrDefault();

            if (keyword == null)
            {
                keyword = new PatternPropertiesKeyword();
                schema.Add(keyword);
            }

            keyword.Add(name, property);

            return(schema);
        }