File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -60,10 +60,25 @@ def deref
6060 return self . class . new_by_type ( document , Hana ::Pointer . parse ( match . post_match ) ) . deref
6161 end
6262
63+ # HAX for how google does refs and ids
64+ if document_node [ 'schemas' ] . respond_to? ( :to_hash )
65+ if document_node [ 'schemas' ] [ content [ '$ref' ] ]
66+ return document_node [ 'schemas' ] [ content [ '$ref' ] ]
67+ end
68+ _ , deref_by_id = document_node [ 'schemas' ] . detect { |_k , schema | schema [ 'id' ] == content [ '$ref' ] }
69+ if deref_by_id
70+ return deref_by_id
71+ end
72+ end
73+
6374 #raise(NotImplementedError, "cannot dereference #{content['$ref']}") # TODO
6475 return self
6576 end
6677
78+ def document_node
79+ Node . new_by_type ( document , [ ] )
80+ end
81+
6782 ESC = { '^' => '^^' , '~' => '~0' , '/' => '~1' } # '/' => '^/' ?
6883 def pointer_path
6984 path . map { |part | "/" + part . to_s . gsub ( /[\^ ~\/ ]/ ) { |m | ESC [ m ] } } . join ( '' )
You can’t perform that action at this time.
0 commit comments