Skip to main content

JSONSchema Spec with object-oriented paths

Project description

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 = {
    "openapi": "3.0.1",
    "info": {
         "$ref": "#/components/Version",
    },
    "paths": {},
    "components": {
        "Version": {
            "title": "Minimal",
            "version": "1.0",
         },
    },
}

spec = Spec.from_dict(d)

# Concatenate paths with /
info = spec / "info"

# Stat path keys
"title" in info

# Open path dict
with info.open() as info_dict:
    print(info_dict)

License

Copyright (c) 2017-2022, Artur Maciag, All rights reserved. Apache v2

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

jsonschema-spec-0.1.2.tar.gz (10.3 kB view hashes)

Uploaded source

Built Distribution

jsonschema_spec-0.1.2-py3-none-any.whl (12.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page