py2http.openapi_utils¶
This module is designed to generate OpenAPI specifications based on Python functions.
It includes functions for creating OpenAPI paths, setting authentication details,
and building OpenAPI templates. The OpenApiExtractor class can be used to extract
information from an existing OpenAPI document.
The func_to_openapi_spec function is particularly useful, as it takes a Python
function as input and generates an OpenAPI path specification, including request
and response schemas.
Overall, this module allows you to define API routes and generate corresponding OpenAPI specifications directly from your Python functions. It provides a convenient way to document and expose your functions as HTTP endpoints.
Functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Classes
|
- py2http.openapi_utils.set_auth(openapi_spec, auth_type='jwt', *, login_details=None)[source]¶
- Parameters:
openapi_spec – An OpenAPI formatted server specification
auth_type – Either ‘jwt’ or ‘api_key’
login_details – Optional - { ‘login_url’: the login url ‘refresh_url’: the refresh url, if applicable ‘login_inputs’: a list of strings e.g. [‘account’, ‘email’, ‘password’] ‘refresh_inputs’: a list of strings e.g. [‘account’, ‘refresh_token’] ‘outputs’: a list of strings e.g. [‘jwt’, ‘refresh_token’] } “”