/// <summary>
        /// Add an `items` keyword to the schema.
        /// </summary>
        public static JsonSchema Items(this JsonSchema schema, JsonSchema definition)
        {
            var keyword = new ItemsKeyword {
                definition
            };

            schema.Add(keyword);

            return(schema);
        }
Esempio n. 2
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(ItemsKeyword other)
 {
     if (other is null)
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(this.ContentsEqual(other));
 }
        /// <summary>
        /// Add an <code>items</code> keyword to the schema.
        /// </summary>
        public static JsonSchema Items(this JsonSchema schema, params JsonSchema[] definitions)
        {
            var keyword = schema.OfType <ItemsKeyword>().FirstOrDefault();

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

            keyword.AddRange(definitions);

            return(schema);
        }
        /// <summary>
        /// Add an `items` keyword to the schema.
        /// </summary>
        public static JsonSchema Item(this JsonSchema schema, JsonSchema definition)
        {
            var keyword = schema.OfType <ItemsKeyword>().FirstOrDefault();

            if (keyword == null)
            {
                keyword = new ItemsKeyword {
                    IsArray = true
                };
                schema.Add(keyword);
            }

            keyword.Add(definition);

            return(schema);
        }