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
here we have a condition if _callable_name in set(Method) or hasattr(_callable, ENDPOINT_METADATA_ATTRIBUTE_NAME ): which means if method names of view are either (get, put, post, delete...) or if they have ENDPOINT_METADATA_ATTRIBUTE_NAME as an attribute and this constant literal's value is ENDPOINT_METADATA_ATTRIBUTE_NAME = "ENDPOINT_METADATA" from line 15 views.py.
But the @endpoint decorator sets the attribute name to __endpoint_metadata instead of ENDPOINT_METADATA (line 106 in fastapi_class/routers.py).
So I believe, fix here is we should replace ENDPOINT_METADATA_ATTRIBUTE_NAME = "ENDPOINT_METADATA" with ENDPOINT_METADATA_ATTRIBUTE_NAME = "__endpoint_metadata"
As I tried above fix for my local, it worked.
May be wrong for fix, I just read the code today, but @endpoint decorator seems not to be working
The text was updated successfully, but these errors were encountered:
Hi,
I am using version 3.5.0 of fastapi-class, when using @endpoint decorator in my view I am not able to get the endpoint available for me to use.
I am using following code.
And I am not able to get kapa endpoint, neither in swagger doc nor from API.
I explored the internal code of fastapi-class, I believe I know the issue, but correct me if I am wrong.
In file fastapi_class/views.py, in method View, in _decorator(line 56)
here we have a condition
if _callable_name in set(Method) or hasattr(_callable, ENDPOINT_METADATA_ATTRIBUTE_NAME ):
which means if method names of view are either (get, put, post, delete...) or if they have ENDPOINT_METADATA_ATTRIBUTE_NAME as an attribute and this constant literal's value isENDPOINT_METADATA_ATTRIBUTE_NAME = "ENDPOINT_METADATA"
from line 15 views.py.But the @endpoint decorator sets the attribute name to __endpoint_metadata instead of ENDPOINT_METADATA (line 106 in fastapi_class/routers.py).
So I believe, fix here is we should replace
ENDPOINT_METADATA_ATTRIBUTE_NAME = "ENDPOINT_METADATA"
withENDPOINT_METADATA_ATTRIBUTE_NAME = "__endpoint_metadata"
As I tried above fix for my local, it worked.
May be wrong for fix, I just read the code today, but @endpoint decorator seems not to be working
The text was updated successfully, but these errors were encountered: