I tried to specify types via strings but it gives an error.
MRE:
@provide(scope=Scope.REQUEST)
async def new_async_session(
self, session_factory: async_sessionmaker[AsyncSession]
) -> AsyncIterator[AnyOf["AsyncSession", "UoWProtocol"]]:
async with session_factory() as session:
yield session
Error:
dishka.exceptions.GraphMissingFactoryError: Cannot find factory for (<class 'sqlalchemy.ext.asyncio.session.AsyncSession'>, component=''). It is missing or has invalid scope.
Though it cannot be probably fixed, we should at least detect this and raise an error with a recommendation to replace with "AnyOf[AsyncSession, UoWProtocol]"
I tried to specify types via strings but it gives an error. MRE:
Error:
dishka.exceptions.GraphMissingFactoryError: Cannot find factory for (<class 'sqlalchemy.ext.asyncio.session.AsyncSession'>, component=''). It is missing or has invalid scope.