Skip to content

Lifespan events are not called when using FastAPI versioning #77

Description

@mathiasyde

Describe the bug
When using VersionedFastAPI wrapper object, lifespan event is not called

To Reproduce
Run

from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi_versioning import VersionedFastAPI

@asynccontextmanager
async def lifespan(app: FastAPI):
    print("Starting app")
    yield
    print("Stopping app")

app = FastAPI(lifespan=lifespan)

# run uvicorn main:app with and without VersionedFastAPI
# app = VersionedFastAPI(app)

Expected behavior
The lifespan events should still be called using or not using VersionedFastAPI

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions