Sha256: 021a99169b4dfce228fbe9f7b68c0a0fcd8ffde5e90ca145fb3bc14234b5cecd

Contents?: true

Size: 529 Bytes

Versions: 5

Compression:

Stored size: 529 Bytes

Contents

module JSON
  class Schema
    class MinLengthAttribute < Attribute
      def self.validate(current_schema, data, fragments, validator, options = {})
        if data.is_a?(String)
          if data.length < current_schema.schema['minLength']
            message = "The property '#{build_fragment(fragments)}' was not of a minimum string length of #{current_schema.schema['minLength']}"
            validation_error(message, fragments, current_schema, options[:record_errors])
          end
        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/minlength.rb
json-schema-1.0.2 lib/json-schema/attributes/minlength.rb
seomoz-json-schema-1.0.1 lib/json-schema/attributes/minlength.rb
json-schema-1.0.1 lib/json-schema/attributes/minlength.rb
json-schema-1.0.0 lib/json-schema/attributes/minlength.rb