Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
return node
def resolve_local(node, json_id):
if isinstance(node, dict) and '$ref' in node:
ref_url = resolver(node['$ref'])
if ref_url.startswith('#'):
parts = urlparse.urlparse(ref_url)
subschema_fragment = reference.resolve_fragment(
schema, parts.fragment)
return subschema_fragment
return node