跳转至

Application Module

pipelines.rest_api.application

get_openapi_specs

get_openapi_specs() -> dict

Used to autogenerate OpenAPI specs file to use in the documentation.

See docs/_src/api/openapi/generate_openapi_specs.py

Source code in pipelines/rest_api/application.py
def get_openapi_specs() -> dict:
    """
    Used to autogenerate OpenAPI specs file to use in the documentation.

    See `docs/_src/api/openapi/generate_openapi_specs.py`
    """
    app = get_application()
    return get_openapi(
        title=app.title,
        version=app.version,
        openapi_version=app.openapi_version,
        description=app.description,
        routes=app.routes,
    )

use_route_names_as_operation_ids

use_route_names_as_operation_ids(app: FastAPI) -> None

Simplify operation IDs so that generated API clients have simpler function names (see https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#using-the-path-operation-function-name-as-the-operationid). The operation IDs will be the same as the route names (i.e. the python method names of the endpoints) Should be called only after all routes have been added.

Source code in pipelines/rest_api/application.py
def use_route_names_as_operation_ids(app: FastAPI) -> None:
    """
    Simplify operation IDs so that generated API clients have simpler function
    names (see https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#using-the-path-operation-function-name-as-the-operationid).
    The operation IDs will be the same as the route names (i.e. the python method names of the endpoints)
    Should be called only after all routes have been added.
    """
    for route in app.routes:
        if isinstance(route, APIRoute):
            route.operation_id = route.name