Generate an OpenAPI specification from a Python class definition
Project description
Generate an OpenAPI specification from a Python class
PyOpenAPI produces an OpenAPI specification in JSON, YAML or HTML format with endpoint definitions extracted from member functions of a strongly-typed Python class.
Features
- supports standard and asynchronous functions (
async def
) - maps function name prefixes such as
get_
orcreate_
to HTTP GET, POST, PUT, DELETE, PATCH - handles both simple and composite types (
int
,str
,Enum
,@dataclass
) - maps Python positional-only and keyword-only arguments (of simple types) to path and query parameters, respectively
- maps composite types to HTTP request body
- supports user-defined routes with decorator
@webmethod
- extracts description text from class and function docstrings (
__doc__
) - recognizes parameter description text given in reStructuredText docstring format (
:param name: ...
) - recursively converts composite types into JSON schemas
- groups frequently used composite types into a separate section and re-uses them with
$ref
- displays generated OpenAPI specification in HTML with ReDoc
Examples
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
python-openapi-0.1.3.tar.gz
(14.3 kB
view hashes)
Built Distribution
Close
Hashes for python_openapi-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acdb6cd8b86f677b30511fc813f0d9177a1a7fdf40514562c7dcca2129f532c3 |
|
MD5 | e233ba83a82d66d2f12e5305f37489c8 |
|
BLAKE2b-256 | 522eb946eaa688e1db78dc1ea375f249eb78c5afd5bd45eca4157815bf9128ff |