Sha256: 86eb02be0c751c0071d8676afe77bec0dfa1970e8fc188a507b554d919d43246

Contents?: true

Size: 509 Bytes

Versions: 5

Compression:

Stored size: 509 Bytes

Contents

module JSON
  class Schema
    class MinItemsAttribute < Attribute
      def self.validate(current_schema, data, fragments, validator, options = {})
        if data.is_a?(Array) && (data.compact.size < current_schema.schema['minItems'])
          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/minitems.rb
json-schema-1.0.2 lib/json-schema/attributes/minitems.rb
seomoz-json-schema-1.0.1 lib/json-schema/attributes/minitems.rb
json-schema-1.0.1 lib/json-schema/attributes/minitems.rb
json-schema-1.0.0 lib/json-schema/attributes/minitems.rb