Issues with custom decorators #11187
Replies: 5 comments
-
|
Can confirm that behavior. |
Beta Was this translation helpful? Give feedback.
-
|
|
Beta Was this translation helpful? Give feedback.
-
|
This is a good fix. However, in some cases, you cannot change the decorator's behavior (e.g. a third-party library). This is how we worked around it: #12496 I'll see if your fix is applicable in our case, as that would be preferable |
Beta Was this translation helpful? Give feedback.
-
|
Try using this approach: When |
Beta Was this translation helpful? Give feedback.
-
|
This was fixed by #5077, works well with FastAPI 0.123.5+ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
main.py
auth.py
Description
I've experienced weird behaviour with decorators from defined on other modules.
Getting
pydantic.errors.PydanticUndefinedAnnotation: name 'Request' is not definedon using a decorator defined on other modules (i.e.auth.auth_external). But, the same works when the decorator copied to the main module (i.eauth_internal)Operating System
Linux
Operating System Details
No response
FastAPI Version
0.109.2
Pydantic Version
2.6.1
Python Version
Python 3.10.12
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions