Skip to main content
https://img.shields.io/pypi/v/jsonschema-spec.svg https://travis-ci.org/p1c2u/jsonschema-spec.svg?branch=master https://img.shields.io/codecov/c/github/p1c2u/jsonschema-spec/master.svg?style=flat https://img.shields.io/pypi/pyversions/jsonschema-spec.svg https://img.shields.io/pypi/format/jsonschema-spec.svg https://img.shields.io/pypi/status/jsonschema-spec.svg

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.6.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsonschema_spec-0.1.6-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file jsonschema_spec-0.1.6.tar.gz.

File metadata

  • Download URL: jsonschema_spec-0.1.6.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Linux/5.15.0-1038-azure

File hashes

Hashes for jsonschema_spec-0.1.6.tar.gz
Algorithm Hash digest
SHA256 90215863b56e212086641956b20127ccbf6d8a3a38343dad01d6a74d19482f76
MD5 d82078bd3520f07df89c8b688bde5741
BLAKE2b-256 a3d5b1c6171af26a3086189c45fcc7145cb40cdb7ab6779806e9e321501f5251

See more details on using hashes here.

File details

Details for the file jsonschema_spec-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: jsonschema_spec-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Linux/5.15.0-1038-azure

File hashes

Hashes for jsonschema_spec-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f2206d18c89d1824c1f775ba14ed039743b41a9167bd2c5bdb774b66b3ca0bbf
MD5 964c7ec22cd265624ac13db2fbe73c81
BLAKE2b-256 52180c62b011d64158c2420594002f58b3ad30a8e982bf8e6b4f078df9e95b9b

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

This release

0.1.6 This release

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page