pytest-httpchain-jsonref 0.4.0__tar.gz → 0.6.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pytest-httpchain-jsonref
3
- Version: 0.4.0
3
+ Version: 0.6.0
4
4
  Summary: JSON reference ($ref) support for pytest-httpchain
5
5
  Author: Alexander Eresov
6
6
  Author-email: Alexander Eresov <aeresov@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pytest-httpchain-jsonref"
3
- version = "0.4.0"
3
+ version = "0.6.0"
4
4
  description = "JSON reference ($ref) support for pytest-httpchain"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -12,6 +12,9 @@ def load_json(path: Path, max_parent_traversal_depth: int = 3, root_path: Path |
12
12
  All three directives ($include, $merge, $ref) work identically. $include and $merge are preferred
13
13
  as they avoid conflicts with VS Code's JSON Schema validation (which treats $ref specially).
14
14
 
15
+ "$schema" keys pass through untouched — whether and where to tolerate them
16
+ is the consumer's decision (pytest-httpchain's models drop them during validation).
17
+
15
18
  Args:
16
19
  path: Path to the JSON file to load
17
20
  max_parent_traversal_depth: Maximum number of parent directory traversals allowed in reference paths
@@ -60,12 +60,27 @@ class CircularDependencyTracker:
60
60
  self.internal_refs.discard(pointer)
61
61
 
62
62
  def create_child_tracker(self) -> Self:
63
- """Create a child tracker that inherits current state.
63
+ """Create a child tracker for descending into an external document.
64
+
65
+ External refs are keyed by ``(file, pointer)`` and inherited, so a
66
+ cross-document cycle (A -> B -> A) is detected along the resolution
67
+ chain.
68
+
69
+ Internal refs are NOT inherited. A JSON pointer like ``#/a`` is only
70
+ meaningful relative to its own document's root, and a child tracker is
71
+ created exactly when resolution crosses into a new document. Carrying
72
+ the parent's open internal pointers across that boundary would conflate
73
+ unrelated documents that happen to reuse the same pointer string and
74
+ raise a phantom cycle. Genuine intra-document internal cycles are still
75
+ caught, because every internal ref within one document shares a single
76
+ tracker instance; genuine cross-document cycles are caught by
77
+ ``external_refs`` (every document-crossing hop is an external ref).
64
78
 
65
79
  Returns:
66
- A new tracker with copies of the current reference sets
80
+ A new tracker inheriting external refs but starting with a fresh,
81
+ empty internal-ref set.
67
82
  """
68
83
  child = self.__class__()
69
84
  child.external_refs = self.external_refs.copy()
70
- child.internal_refs = self.internal_refs.copy()
85
+ child.internal_refs = set()
71
86
  return child