Sha256: 8ecc98e01c4247bfb2a1a58f3abda59aa3656ae97a3ca1e6ba34a0a64944f03a

Contents?: true

Size: 582 Bytes

Versions: 3

Compression:

Stored size: 582 Bytes

Contents

require 'json-schema/attribute'

module JSON
  class Schema
    class MaxPropertiesAttribute < Attribute
      def self.validate(current_schema, data, fragments, processor, validator, options = {})
        if data.is_a?(Hash) && (data.size > current_schema.schema['maxProperties'])
          message = "The property '#{build_fragment(fragments)}' did not contain a minimum number of properties #{current_schema.schema['maxProperties']}"
          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/maxproperties.rb
json-schema-2.4.0 lib/json-schema/attributes/maxproperties.rb
json-schema-2.3.0 lib/json-schema/attributes/maxproperties.rb