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

Object-oriented JSONSchema

Key features

  • Traverse schema like paths

  • Access schema 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 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

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.2.3.tar.gz (11.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.2.3-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jsonschema_spec-0.2.3.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure

File hashes

Hashes for jsonschema_spec-0.2.3.tar.gz
Algorithm Hash digest
SHA256 e01b8b100f0676177b0b39027a5cab7e7a16ce4316a3d0d15e576293d954fafc
MD5 be9d9ba0619305df2d9db46eae948eae
BLAKE2b-256 7915473588e24d57d92003f7823fdbf682a6f55ffced942e5211bc3025d89c1d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for jsonschema_spec-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ee005ddeca73229560ac2b8f1849590929c4b2cd17a932b229b03566e517f2a6
MD5 f1654f9ccff52d3ef0b4961e75e4568d
BLAKE2b-256 6ac39ccf904bb987d1925a5c0c7a482d6d132f62669902338f2aafc179345448

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.4

2 files

This release

0.2.3 This release

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.6

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