-
-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Description
taskiq == 0.11.18
import asyncio
from typing import Annotated
from taskiq import Context
from taskiq import TaskiqDepends
from taskiq import InMemoryBroker
broker = InMemoryBroker()
@broker.task("my_task")
async def my_task(context: Annotated[Context, TaskiqDepends()], x: int) -> None:
print(f'{x=}')
if __name__ == "__main__":
asyncio.run(my_task.kiq(1))Expected:
$ x=1Real:
pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <class 'taskiq.context.Context'>. Set `arbitrary_types_allowed=True` in the model_config to ignore this error or implement `__get_pydantic_core_schema__` on your type to fully support it.BUT:
@broker.task("my_task")
async def my_task(x: int, context: Annotated[Context, TaskiqDepends()]) -> None:
print(f'{x=}')Will work as expected.
Problem:
When parsing params in https://github.com/taskiq-python/taskiq/blob/master/taskiq/receiver/params_parser.py#L70
Dependency might be ignored.
Metadata
Metadata
Assignees
Labels
No labels