Skip to content

Commit

Permalink
Merge b44258b into c02e974
Browse files Browse the repository at this point in the history
  • Loading branch information
notEthan committed Aug 30, 2021
2 parents c02e974 + b44258b commit d9cacaa
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions lib/jsi/schema/ref.rb
Expand Up @@ -105,24 +105,9 @@ def deref_schema
check_schema_resource_root.call

# find an anchor that resembles the fragment
result_schemas = JSI::Util.ycomb do |rec|
proc do |node|
Set[].tap do |out|
if node.is_a?(JSI::Schema) && node.respond_to?(:anchor) && node.anchor == fragment
out << node
end
if node.respond_to?(:to_hash)
node.to_hash.values.each do |v|
out.merge(rec.call(v))
end
elsif node.respond_to?(:to_ary)
node.to_ary.each do |e|
out.merge(rec.call(e))
end
end
end
end
end.call(schema_resource_root)
result_schemas = schema_resource_root.jsi_each_child_node.select do |node|
node.is_a?(JSI::Schema) && node.respond_to?(:anchor) && node.anchor == fragment
end

if result_schemas.size == 1
result_schema = result_schemas.first
Expand Down

0 comments on commit d9cacaa

Please sign in to comment.