Closed YanSte closed 3 months ago
I found this solution: (Pydantic v1)
# No @inject
class A(BaseModel):
...
b: B = Field(default_factory=lambda: di[B])
Could you tell me what you think?
After a try that works great ✌️ Thanks a lot you save my time.
Hi,
Thank you very much for your work on this library. It's simple and easy to use. I considered using another library, but it hasn't been updated.
I have a question regarding the integration with Pydantic. Specifically, I want to know how to use dependency injection with Pydantic models. Here's what I mean:
Is it possible to inject
B
without implementing the__init__
method manually?Thank you!