private void ValidateArray()

in src/Json.Schema.Validation/Validator.cs [244:275]


        private void ValidateArray(JArray jArray, JsonSchema schema)
        {
            int numItems = jArray.Count;
            if (numItems < schema.MinItems)
            {
                AddResult(jArray, ErrorNumber.TooFewArrayItems, schema.MinItems, numItems);
            }

            if (numItems > schema.MaxItems)
            {
                AddResult(jArray, ErrorNumber.TooManyArrayItems, schema.MaxItems, numItems);
            }

            if (schema.UniqueItems == true)
            {
                ValidateUnique(jArray);
            }

            // 5.3.1.3 The only case where the array itself can fail to validate (as
            // opposed to the array elements) is if "additionalItems" is false and
            // "items" is an array.
            if (schema.Items != null &&
                !schema.Items.SingleSchema &&
                schema.AdditionalItems != null &&
                !schema.AdditionalItems.Allowed &&
                jArray.Count > schema.Items.Schemas.Count)
            {
                AddResult(jArray, ErrorNumber.TooFewItemSchemas, jArray.Count, schema.Items.Schemas.Count);
            }

            ValidateArrayItems(jArray, schema);
        }