schemathesis 3.28.0__py3-none-any.whl → 3.29.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -65,10 +65,13 @@ class InliningResolver(jsonschema.RefResolver):
65
65
 
66
66
  def resolve_all(self, item: JSONType, recursion_level: int = 0) -> JSONType:
67
67
  """Recursively resolve all references in the given object."""
68
+ resolve = self.resolve_all
68
69
  if isinstance(item, dict):
69
70
  ref = item.get("$ref")
70
- if ref is not None and isinstance(ref, str):
71
- with self.resolving(ref) as resolved:
71
+ if isinstance(ref, str):
72
+ url, resolved = self.resolve(ref)
73
+ self.push_scope(url)
74
+ try:
72
75
  # If the next level of recursion exceeds the limit, then we need to copy it explicitly
73
76
  # In other cases, this method create new objects for mutable types (dict & list)
74
77
  next_recursion_level = recursion_level + 1
@@ -76,10 +79,18 @@ class InliningResolver(jsonschema.RefResolver):
76
79
  copied = fast_deepcopy(resolved)
77
80
  remove_optional_references(copied)
78
81
  return copied
79
- return self.resolve_all(resolved, next_recursion_level)
80
- return {key: self.resolve_all(sub_item, recursion_level) for key, sub_item in item.items()}
82
+ return resolve(resolved, next_recursion_level)
83
+ finally:
84
+ self.pop_scope()
85
+ return {
86
+ key: resolve(sub_item, recursion_level) if isinstance(sub_item, (dict, list)) else sub_item
87
+ for key, sub_item in item.items()
88
+ }
81
89
  if isinstance(item, list):
82
- return [self.resolve_all(sub_item, recursion_level) for sub_item in item]
90
+ return [
91
+ self.resolve_all(sub_item, recursion_level) if isinstance(sub_item, (dict, list)) else sub_item
92
+ for sub_item in item
93
+ ]
83
94
  return item
84
95
 
85
96
  def resolve_in_scope(self, definition: dict[str, Any], scope: str) -> tuple[list[str], dict[str, Any]]:
@@ -89,7 +100,7 @@ class InliningResolver(jsonschema.RefResolver):
89
100
  if "$ref" in definition:
90
101
  self.push_scope(scope)
91
102
  try:
92
- new_scope, definition = fast_deepcopy(self.resolve(definition["$ref"]))
103
+ new_scope, definition = self.resolve(definition["$ref"])
93
104
  finally:
94
105
  self.pop_scope()
95
106
  scopes.append(new_scope)