Class: JSON::Schema::MinItemsAttribute

Inherits:
LimitAttribute show all
Defined in:
lib/json-schema/attributes/limit.rb

Direct Known Subclasses

MaxItemsAttribute

Constant Summary

Constants inherited from Attribute

Attribute::TYPE_CLASS_MAPPINGS

Class Method Summary collapse

Methods inherited from LimitAttribute

exclusive?, invalid?, limit, validate

Methods inherited from Attribute

build_fragment, data_valid_for_type?, validate, validation_error, validation_errors

Class Method Details

.acceptable_typeObject


81
82
83
# File 'lib/json-schema/attributes/limit.rb', line 81

def self.acceptable_type
  Array
end

.error_message(schema) ⇒ Object


93
94
95
# File 'lib/json-schema/attributes/limit.rb', line 93

def self.error_message(schema)
  "did not contain a minimum number of items #{limit(schema)}"
end

.limit_nameObject


89
90
91
# File 'lib/json-schema/attributes/limit.rb', line 89

def self.limit_name
  'minItems'
end

.value(data) ⇒ Object


85
86
87
# File 'lib/json-schema/attributes/limit.rb', line 85

def self.value(data)
  data.length
end