module Openc::JsonSchema::Utils

Public Instance Methods

extract_json_schema(validator) click to toggle source
# File lib/openc/json_schema/utils.rb, line 20
def extract_json_schema(validator)
  validator.instance_variable_get(:@base_schema)
end
load_validator(schema_path, record, options={}) click to toggle source
# File lib/openc/json_schema/utils.rb, line 6
def load_validator(schema_path, record, options={})
  default_options = {
    :record_errors => true,
    :errors_as_objects => true,
    :validate_schema => false
  }

  validator = JSON::Validator.new(
    schema_path,
    record,
    default_options.merge(options)
  )
end