Skip to content

ChristianWeymannTNG/jsonschema-spec

 
 

Repository files navigation

JSONSchema Spec

https://travis-ci.org/p1c2u/jsonschema-spec.svg?branch=master https://img.shields.io/codecov/c/github/p1c2u/jsonschema-spec/master.svg?style=flat

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)

Related projects

  • openapi-core
    Python library that adds client-side and server-side support for the OpenAPI.
  • openapi-spec-validator
    Python library that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0 specification
  • openapi-schema-validator
    Python library that validates schema against the OpenAPI Schema Specification v3.0.

License

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

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%