Sha256: d5b5926706c9a1afb45d554eb22cca3fd4f998d495b92f46f9c053dae9840200
Contents?: true
Size: 947 Bytes
Versions: 10
Compression:
Stored size: 947 Bytes
Contents
module Lurker module Json class Reference < Schema attr_reader :original_uri delegate :merge!, :replace!, :reorder!, to: :@schema def to_original_hash(options = {}) @original_schema.to_hash end private def parse_schema(schema) @original_schema = schema.dup # NOTE : We decide that reference is relative, so we are using merge # We use first read for correct relative path resolving reader = Lurker::Json::Reader.new(@uri.merge(schema[Json::REF]).path) payload = reader.payload @original_uri = parse_uri(reader.path) @schema = @parser.plain(uri: reader.path).parse(payload) # NOTE : The easiest way to get schema copy is to parse it again. # It's faster and reliable # @_schema = @parser.plain(uri: reader.path).parse(reader.payload) # @_schema_file = URI.parse(reader.path) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems