Sha256: 426a781013cdfda2a4a64252abdf83569f6701b09339b5ee1d0ac67a02f51a62

Contents?: true

Size: 582 Bytes

Versions: 3

Compression:

Stored size: 582 Bytes

Contents

require 'json-schema/attribute'

module JSON
  class Schema
    class MinPropertiesAttribute < Attribute
      def self.validate(current_schema, data, fragments, processor, validator, options = {})
        if data.is_a?(Hash) && (data.size < current_schema.schema['minProperties'])
          message = "The property '#{build_fragment(fragments)}' did not contain a minimum number of properties #{current_schema.schema['minProperties']}"
          validation_error(processor, message, fragments, current_schema, self, options[:record_errors])
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
json-schema-2.4.1 lib/json-schema/attributes/minproperties.rb
json-schema-2.4.0 lib/json-schema/attributes/minproperties.rb
json-schema-2.3.0 lib/json-schema/attributes/minproperties.rb