About
JSONSchema Spec with object-oriented paths
Key features
Traverse elements like paths
Access spec on demand with separate dereferencing accessor layer
Installation
pip install jsonschema-spec
Alternatively you can download the code and install from the repository:
pip install -e git+https://github.com/p1c2u/jsonschema-spec.git#egg=jsonschema_spec
Usage
>>> from jsonschema_spec import Spec
>>> d = {
... "properties": {
... "info": {
... "$ref": "#/$defs/Info",
... },
... },
... "$defs": {
... "Info": {
... "properties": {
... "title": {
... "$ref": "http://example.com",
... },
... "version": {
... "type": "string",
... "default": "1.0",
... },
... },
... },
... },
... }
>>> spec = Spec.from_dict(d)
>>> # Stat keys
>>> "properties" in spec
True
>>> # Concatenate paths with /
>>> info_spec = spec / "properties" / "info"
>>> # Stat keys with implicit dereferencing
>>> "properties" in info_spec
True
>>> # Concatenate paths with implicit dereferencing
>>> version_spec = info_spec / "properties" / "version"
>>> # Open content with implicit dereferencing
>>> with version_spec.open() as version:
... print(version)
{'type': 'string', 'default': '1.0'}
License
Copyright (c) 2017-2022, Artur Maciag, All rights reserved. Apache-2.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jsonschema_spec-0.1.4.tar.gz
(10.2 kB
view details)
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 jsonschema_spec-0.1.4.tar.gz.
File metadata
- Download URL: jsonschema_spec-0.1.4.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/1.4.0 CPython/3.11.2 Linux/5.15.0-1034-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
824c743197bbe2104fcc6dce114a4082bf7f7efdebf16683510cb0ec6d8d53d0
|
|
| MD5 |
096f011d6095a3477bb212b58f2d04d8
|
|
| BLAKE2b-256 |
e9027f9a208cde31dfc728f02b4bb5210944fed6dae68d8b6872eacef10ac363
|
File details
Details for the file jsonschema_spec-0.1.4-py3-none-any.whl.
File metadata
- Download URL: jsonschema_spec-0.1.4-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/1.4.0 CPython/3.11.2 Linux/5.15.0-1034-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34471d8b60e1f06d174236c4d3cf9590fbf3cff1cc733b28d15cd83672bcd062
|
|
| MD5 |
7271d550e01912c4eb748524c87271f4
|
|
| BLAKE2b-256 |
d6c4ae6ef0d61df90f9e5a059e4ff8f29031702e96281b61bd9276c8bcd1e9e9
|