JSONSchema Spec with object-oriented paths
Project description
About
Object-oriented JSONSchema
Key features
Traverse schema like paths
Access schema on demand with separate dereferencing accessor layer
Installation
pip install jsonschema-path
Alternatively you can download the code and install from the repository:
pip install -e git+https://github.com/p1c2u/jsonschema-path.git#egg=jsonschema_path
Usage
>>> from jsonschema_path import SchemaPath
>>> d = {
... "properties": {
... "info": {
... "$ref": "#/$defs/Info",
... },
... },
... "$defs": {
... "Info": {
... "properties": {
... "title": {
... "$ref": "http://example.com",
... },
... "version": {
... "type": "string",
... "default": "1.0",
... },
... },
... },
... },
... }
>>> path = SchemaPath.from_dict(d)
>>> # Stat keys
>>> "properties" in path
True
>>> # Concatenate paths with /
>>> info_path = path / "properties" / "info"
>>> # Stat keys with implicit dereferencing
>>> "properties" in info_path
True
>>> # Concatenate paths with implicit dereferencing
>>> version_path = info_path / "properties" / "version"
>>> # Open content with implicit dereferencing
>>> with version_path.open() as contents:
... print(contents)
{'type': 'string', 'default': '1.0'}
License
Copyright (c) 2017-2022, Artur Maciag, All rights reserved. Apache-2.0
Project details
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
File details
Details for the file jsonschema_path-0.3.4.tar.gz
.
File metadata
- Download URL: jsonschema_path-0.3.4.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8365356039f16cc65fddffafda5f58766e34bebab7d6d105616ab52bc4297001 |
|
MD5 | e4a1b0d9967124b71c237e868fe819b5 |
|
BLAKE2b-256 | 6e4541ebc679c2a4fced6a722f624c18d658dee42612b83ea24c1caf7c0eb3a8 |
Provenance
The following attestation bundles were made for jsonschema_path-0.3.4.tar.gz
:
Publisher:
python-publish.yml
on p1c2u/jsonschema-path
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
jsonschema_path-0.3.4.tar.gz
- Subject digest:
8365356039f16cc65fddffafda5f58766e34bebab7d6d105616ab52bc4297001
- Sigstore transparency entry: 165206706
- Sigstore integration time:
- Permalink:
p1c2u/jsonschema-path@22cee96986ea491465511548617754e072b19502
- Branch / Tag:
refs/tags/0.3.4
- Owner: https://github.com/p1c2u
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
python-publish.yml@22cee96986ea491465511548617754e072b19502
- Trigger Event:
release
- Statement type:
File details
Details for the file jsonschema_path-0.3.4-py3-none-any.whl
.
File metadata
- Download URL: jsonschema_path-0.3.4-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f502191fdc2b22050f9a81c9237be9d27145b9001c55842bece5e94e382e52f8 |
|
MD5 | 3d31da164d834a32d4b4226e5be116d5 |
|
BLAKE2b-256 | cb583485da8cb93d2f393bce453adeef16896751f14ba3e2024bc21dc9597646 |
Provenance
The following attestation bundles were made for jsonschema_path-0.3.4-py3-none-any.whl
:
Publisher:
python-publish.yml
on p1c2u/jsonschema-path
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
jsonschema_path-0.3.4-py3-none-any.whl
- Subject digest:
f502191fdc2b22050f9a81c9237be9d27145b9001c55842bece5e94e382e52f8
- Sigstore transparency entry: 165206710
- Sigstore integration time:
- Permalink:
p1c2u/jsonschema-path@22cee96986ea491465511548617754e072b19502
- Branch / Tag:
refs/tags/0.3.4
- Owner: https://github.com/p1c2u
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
python-publish.yml@22cee96986ea491465511548617754e072b19502
- Trigger Event:
release
- Statement type: