Sha256: 74202130689bdab560a1aaa6ff1e07505f0087e921c56f855cd9dbde9bd1d4e6

Contents?: true

Size: 720 Bytes

Versions: 11

Compression:

Stored size: 720 Bytes

Contents

module JSON
  class Schema
    class NotAttribute < Attribute
      def self.validate(current_schema, data, fragments, processor, validator, options = {})

        schema = JSON::Schema.new(current_schema.schema['not'],current_schema.uri,validator)
        failed = true
        begin
          schema.validate(data,fragments,processor,options)
          message = "The property '#{build_fragment(fragments)}' of type #{data.class} matched the disallowed schema"
          failed = false
        rescue
          # Yay, we failed validation
        end

        unless failed
          validation_error(processor, message, fragments, current_schema, self, options[:record_errors])
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
json-schema-2.1.4 lib/json-schema/attributes/not.rb
json-schema-2.1.3 lib/json-schema/attributes/not.rb
json-schema-2.1.2 lib/json-schema/attributes/not.rb
json-schema-2.1.1 lib/json-schema/attributes/not.rb
json-schema-2.1.0 lib/json-schema/attributes/not.rb
json-schema-2.0.5 lib/json-schema/attributes/not.rb
json-schema-2.0.4 lib/json-schema/attributes/not.rb
json-schema-2.0.3 lib/json-schema/attributes/not.rb
json-schema-2.0.2 lib/json-schema/attributes/not.rb
json-schema-2.0.1 lib/json-schema/attributes/not.rb
json-schema-2.0.0 lib/json-schema/attributes/not.rb