Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def resolve_refs(node, json_id):
if json_id is None:
json_id = url
if isinstance(node, dict) and '$ref' in node:
suburl = generic_io.resolve_uri(json_id, resolver(node['$ref']))
parts = urlparse.urlparse(suburl)
fragment = parts.fragment
if len(fragment):
suburl_path = suburl[:-(len(fragment) + 1)]
else:
suburl_path = suburl
suburl_path = resolver(suburl_path)
if suburl_path == url:
subschema = schema
else:
subschema = load_schema(suburl_path, resolver, True)
subschema_fragment = reference.resolve_fragment(
subschema, fragment)
return subschema_fragment