Sha256: 1a714b2ebf97867f7662d46dc18fe103210202e5c1515557e54a23c3b9ea8643

Contents?: true

Size: 858 Bytes

Versions: 1

Compression:

Stored size: 858 Bytes

Contents

module JSON
  class Schema
    class Validator
      attr_accessor :attributes, :formats, :uri, :names, :metaschema
      attr_reader :default_formats

      def initialize()
        @attributes = {}
        @formats = {}
        @default_formats = {}
        @uri = nil
        @names = []
        @metaschema = ''
      end

      def extend_schema_definition(schema_uri)
        validator = JSON::Validator.validator_for(schema_uri)
        @attributes.merge!(validator.attributes)
      end

      def validate(current_schema, data, fragments, processor, options = {})
        current_schema.schema.each do |attr_name,attribute|
          if @attributes.has_key?(attr_name.to_s)
            @attributes[attr_name.to_s].validate(current_schema, data, fragments, processor, self, options)
          end
        end
        data
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
json-schema-2.3.0 lib/json-schema/schema/validator.rb