Closed hasansezertasan closed 10 months ago
It can not be done with decorators, because the decorator is applied to / enhances the decorated function, and not the FastAPI
or APIRouter
get
, post
, etc. methods. What could be done is adding a small utility function that adds the info to the mentioned methods - this may be in the scope of this lib. Another option would be subclassing e.g. APIRouter
, but that's definitely out of scope here.
It can not be done with decorators, because the decorator is applied to / enhances the decorated function, and not the
FastAPI
orAPIRouter
get
,post
, etc. methods.
Can't we register annotations to a function wrapped by a decorators?
What could be done is adding a small utility function that adds the info to the mentioned methods - this may be in the scope of this lib.
Are you talking about modifying the OpenAPI Schema?
Another option would be subclassing e.g.
APIRouter
, but that's definitely out of scope here.
I couldn't agree more!
I think I see what you meant now. This could be fixed by adding a Header
dependency to get_hx_request()
. I'll get it done soon.
I think I see what you meant now. This could be fixed by adding a
Header
dependency toget_hx_request()
. I'll get it done soon.
Fantastic! I'm looking forward to seeing it flying... 🥏 Leaving this issue open, don't forget to address this issue when you open a PR 😇.
Released :)
Damn!
Is there a way to make these decorators swagger-compliant?
Edit: The
hx-request
header parameter doesn't show up on the SwaggerUI.