Sha256: 6d7c9f948192d20213c42cfd53ae42a55b12d8d4388251ccd0252e8d23b8656c

Contents?: true

Size: 509 Bytes

Versions: 5

Compression:

Stored size: 509 Bytes

Contents

module JSON
  class Schema
    class MaxItemsAttribute < Attribute
      def self.validate(current_schema, data, fragments, validator, options = {})
        if data.is_a?(Array) && (data.compact.size > current_schema.schema['maxItems'])
          message = "The property '#{build_fragment(fragments)}' did not contain a minimum number of items #{current_schema.schema['minItems']}"
          validation_error(message, fragments, current_schema, options[:record_errors])
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
json-schema-1.0.3 lib/json-schema/attributes/maxitems.rb
json-schema-1.0.2 lib/json-schema/attributes/maxitems.rb
seomoz-json-schema-1.0.1 lib/json-schema/attributes/maxitems.rb
json-schema-1.0.1 lib/json-schema/attributes/maxitems.rb
json-schema-1.0.0 lib/json-schema/attributes/maxitems.rb