Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip inject if cast is disabled and there's nothing to inject #152

Open
Olegt0rr opened this issue Dec 1, 2024 · 2 comments
Open

Skip inject if cast is disabled and there's nothing to inject #152

Olegt0rr opened this issue Dec 1, 2024 · 2 comments

Comments

@Olegt0rr
Copy link
Contributor

Olegt0rr commented Dec 1, 2024

If type casting disabled and the function being decorated has no objects for injection, we may not decorate the original function, returning the original one.

This behavior is convenient for implementing automatic function decoration (similar to how FastAPI does not require a separate decorator for Depends to work in handlers).

Discussion link (ru) - https://t.me/python_faststream/40815

@Lancetnik
Copy link
Owner

If you have some time and would like to help with this feature - you can easely add such functional by checking real_model object for dependencies something here: https://github.com/Lancetnik/FastDepends/blob/feat/optional-pydantic/fast_depends/use.py#L163

@Lancetnik
Copy link
Owner

You need to check model.dependencies and model.extra_dependencies fields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants