Skip to main content

OpenAPI v3 Object Model and Helpers

Project description

OpenAPI v3 Tools

Build Status PyPI PyPI

OpenAPI v3 object model and helpers.

Installation

pip install openapitools

Usage

from openapitools import SpecificationBuilder, ComponentsBuilder, OperationBuilder, Schema


class Todo:
    id: int
    text: str
    done: False


components = ComponentsBuilder()
components.scheme(Todo.__name__, Schema.make(Todo))

builder = SpecificationBuilder(components)
builder.describe('TODO REST API', '1.0')
builder.license('MIT')
builder.contact('John Doe', 'https://example.com', 'john-doe@example.com')

get_todo = OperationBuilder()
get_todo.parameter('id', int, 'path')
get_todo.describe('Get todo by ID')
get_todo.tag('todo')
get_todo.response(200, Todo)

builder.operation('/todo/{id}', 'GET', get_todo)

print(builder.build())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for openapitools, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size openapitools-0.0.2-py3-none-any.whl (8.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size openapitools-0.0.2.tar.gz (6.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page