JSON reference ($ref) support for pytest-httpchain
Project description
pytest-httpchain-jsonref
JSON reference ($ref) resolution with deep merging, used by
pytest-httpchain.
This package loads a JSON document and resolves reference directives into a
single in-memory structure. It supports external file references, JSON-pointer
references within a document, and combined file.json#/pointer references.
Sibling properties next to a directive are merged additively with the
referenced content (keys added, lists concatenated, dicts merged recursively;
a conflicting scalar raises rather than silently overriding). It also enforces a
few safety constraints — a parent-traversal depth limit, an optional root
directory that references may not escape, and circular-reference detection.
Role in the workspace
pytest-httpchain lets an HTTP test scenario be split across reusable JSON
fragments. At collection time the plugin calls this package to inline every
$ref / $include / $merge directive before the resulting document is
validated against the
models. It is published
separately so the resolution logic can be reused and tested on its own; it is
not intended to be used directly outside the plugin.
Usage
from pytest_httpchain_jsonref import load_json, ReferenceResolverError
try:
data = load_json("scenario.json", max_parent_traversal_depth=3, root_path="tests")
except ReferenceResolverError as e:
print(f"could not resolve references: {e}")
Three directives are accepted and behave identically — $include and $merge
are preferred (they avoid clashing with editor JSON Schema validation), while
$ref is the legacy spelling:
{
"$include": "base.json#/definitions/login",
"extra": "merged with the referenced content"
}
Links
- Documentation: https://aeresov.github.io/pytest-httpchain/
- Source and issues: https://github.com/aeresov/pytest-httpchain
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_httpchain_jsonref-0.8.0.tar.gz.
File metadata
- Download URL: pytest_httpchain_jsonref-0.8.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
557d85f4265282d0a0b728bb9037f9f0cde168fa575f2907c061c904b79d2db3
|
|
| MD5 |
aea7738c6fcd453d47e85774daabedbc
|
|
| BLAKE2b-256 |
296a65d8b60bb53475c57ae93dc6e823a72d3d61dd305684996fb75235cc9a93
|
Provenance
The following attestation bundles were made for pytest_httpchain_jsonref-0.8.0.tar.gz:
Publisher:
publish.yml on aeresov/pytest-httpchain
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_httpchain_jsonref-0.8.0.tar.gz -
Subject digest:
557d85f4265282d0a0b728bb9037f9f0cde168fa575f2907c061c904b79d2db3 - Sigstore transparency entry: 1823979470
- Sigstore integration time:
-
Permalink:
aeresov/pytest-httpchain@a18fdb9340066f3a4a0a285e42007bec82a2d2d3 -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/aeresov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a18fdb9340066f3a4a0a285e42007bec82a2d2d3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pytest_httpchain_jsonref-0.8.0-py3-none-any.whl.
File metadata
- Download URL: pytest_httpchain_jsonref-0.8.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0faa6c46f3db847670267255402aa4b1d6186b0995319a59a44b0c7ca11187e9
|
|
| MD5 |
657b854abba657b58d1b6e443abf4165
|
|
| BLAKE2b-256 |
642b743a3bc6c8b142723c1118ea2fdaa346fafd081b3cf0e9b55be6931f3abb
|
Provenance
The following attestation bundles were made for pytest_httpchain_jsonref-0.8.0-py3-none-any.whl:
Publisher:
publish.yml on aeresov/pytest-httpchain
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_httpchain_jsonref-0.8.0-py3-none-any.whl -
Subject digest:
0faa6c46f3db847670267255402aa4b1d6186b0995319a59a44b0c7ca11187e9 - Sigstore transparency entry: 1823981711
- Sigstore integration time:
-
Permalink:
aeresov/pytest-httpchain@a18fdb9340066f3a4a0a285e42007bec82a2d2d3 -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/aeresov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a18fdb9340066f3a4a0a285e42007bec82a2d2d3 -
Trigger Event:
release
-
Statement type: