Module: SimpleJSONSchema::RefHelper
- Defined in:
- lib/simple_json_schema/ref_helper.rb
Defined Under Namespace
Classes: RefPointer
Constant Summary collapse
- INTEGER_REGEX =
/\A-?\d+\Z/.freeze
- POINTER_SPLIT =
%r{(?<!\^)/}.freeze
- POINTER_GSUB =
%r{\^[/^]|~[01]}.freeze
- POINTER_ESC =
{ '^/' => '/', '^^' => '^', '~0' => '~', '~1' => '/' }.freeze
Class Method Summary collapse
Class Method Details
.pointer(scope) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/simple_json_schema/ref_helper.rb', line 12 def pointer(scope) ref = scope[:$ref] return nil if ref.nil? if ref.start_with?('#') local_ref(scope, ref[1..]) else ref_uri = URIExtender.join_uri(scope.parent_uri, ref) if (id = scope.loaded_ids[ref_uri.to_s]) return RefPointer.new(ref_paths: id[:schema_paths], segment: id[:schema], parent_uri: ref_uri) end uri_ref(scope, ref_uri) end end |