in src/rpdk/core/jsonutils/inliner.py [0:0]
def _walk(self, obj, old_path):
if isinstance(obj, str):
return # very common, easier to debug this case
if isinstance(obj, Mapping):
for key, value in obj.items():
if key == "$ref":
if old_path in self.ref_graph:
LOG.debug("Already visited '%s' (%s)", old_path, value)
return
url, resolved = self.resolve(value)
LOG.debug("Resolved '%s' to '%s'", value, url)
# parse the URL into
new_path = self.renamer.parse_ref_url(url)
LOG.debug("Parsed '%s' to '%s'", url, new_path)
LOG.debug("Edge from '%s' to '%s'", old_path, new_path)
self.ref_graph[old_path] = new_path
self.push_scope(url)
try:
self._walk(resolved, new_path)
finally:
self.pop_scope()
else:
self._walk(value, old_path + (key,))
# order matters, both Mapping and strings are also Iterable
elif isinstance(obj, Iterable):
for i, value in enumerate(obj):
self._walk(value, old_path + (str(i),))