JSON schema Utils
Project description
ju
JSON schema Utils
To install: pip install ju
Examples
Routes
Represents a collection of routes in an OpenAPI specification.
Each instance of this class contains a list of Route
objects, which can be accessed and manipulated as needed.
>>> from yaml import safe_load
>>> spec_yaml = '''
... openapi: 3.0.3
... paths:
... /items:
... get:
... summary: List items
... responses:
... '200':
... description: An array of items
... post:
... summary: Create item
... responses:
... '201':
... description: Item created
... '''
>>> spec = safe_load(spec_yaml)
>>> routes = Routes(spec)
>>> len(routes)
2
>>> list(routes)
[('get', '/items'), ('post', '/items')]
>>> r = routes['get', '/items']
>>> r
Route(method='get', endpoint='/items')
>>> r.method_data
{'summary': 'List items', 'responses': {'200': {'description': 'An array of items'}}}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ju-0.1.1.tar.gz
(11.5 kB
view hashes)
Built Distribution
ju-0.1.1-py3-none-any.whl
(13.6 kB
view hashes)