You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change introduces the ability to manually override dependencies in `fastapi-injectable`. Any arguments explicitly passed to an `@injectable` function will now take priority over the dependency injection system.
This is particularly useful for:
- Mocking dependencies in tests.
- Providing values directly in CLI tools.
This change also fixes a bug where `fastapi-injectable` would still resolve a dependency even if it was explicitly provided as an argument, causing unexpected behavior.
Fixes: #133
print(process_data(db=mock_db)) # Explicitly pass the mock dependency
185
+
# Output: "mock data"
186
+
```
187
+
151
188
### Generator Dependencies with Cleanup
152
189
153
190
When working with generator dependencies that require cleanup (like database connections or file handles), `fastapi-injectable` provides built-in support for controlling dependency lifecycles and proper resource management with error handling.
0 commit comments