Exemplo n.º 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(VocabularyKeyword other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(other.ContentsEqual(this));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add a single property requirement to the `properties` keyword.
        /// </summary>
        public static JsonSchema Vocabulary(this JsonSchema schema, SchemaVocabulary vocabulary, bool required)
        {
            var keyword = schema.OfType <VocabularyKeyword>().FirstOrDefault();

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

            keyword[vocabulary] = required;

            return(schema);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Add a single property requirement to the `properties` keyword.
        /// </summary>
        public static JsonSchema Vocabulary(this JsonSchema schema, string id, bool required)
        {
            var keyword = schema.OfType <VocabularyKeyword>().FirstOrDefault();

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

            var vocabulary = SchemaKeywordCatalog.GetVocabulary(id) ?? new SchemaVocabulary(id);

            keyword[vocabulary] = required;

            return(schema);
        }