Sha256: 9c5b7c08bacdda3ac97a20d9a8f714158bd03fd4f827e98354481160ee9011e8
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true module JSONSchemer class Keyword include Output attr_reader :value, :parent, :root, :parsed def initialize(value, parent, keyword, schema = parent) @value = value @parent = parent @root = parent.root @keyword = keyword @schema = schema @parsed = parse end def validate(_instance, _instance_location, _keyword_location, _context) nil end def absolute_keyword_location @absolute_keyword_location ||= "#{parent.absolute_keyword_location}/#{fragment_encode(escaped_keyword)}" end def schema_pointer @schema_pointer ||= "#{parent.schema_pointer}/#{escaped_keyword}" end def error_key keyword end def fetch(key) parsed.fetch(parsed.is_a?(Array) ? key.to_i : key) end def parsed_schema parsed.is_a?(Schema) ? parsed : nil end private def parse value end def subschema(value, keyword = nil, **options) options[:base_uri] ||= schema.base_uri options[:meta_schema] ||= schema.meta_schema Schema.new(value, self, root, keyword, **options) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
json_schemer-2.1.1 | lib/json_schemer/keyword.rb |