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
So... I'm trying to create a simple pluggable FastAPI application where plugins can add, or not, API endpoints. Now is working fine so every plugin adds its own API endpoints. But what if a plugin can extend other plugins, to add or modify its endpoints...
For that, I build a plugin graph to handle the plugin dependencies and now a plugin can import the router from its dependencies and add some new endpoints. But I can´t overwrite the existing endpoints with the new routes.
I have also found an interesting thing in the generated API /docs that maybe can be a bug. The sample code generates this doc, which seems to be OK to me:
But... the endpoint returns the wrong response:
At this point, I spect to have a "hello world 2!" response from new_index not a "hello world!" from index
Following a suggestion in the StackOverflow comment, I found this solution which I'm not happy with
I mean I'm not happy because I can´t find a good way to replace the route, since the __eq__ to check if the route is in the list is on starlette.routing.Route so this was a simplest solution that I Found
Operating System
Linux
Operating System Details
Fedora 35
FastAPI Version
0.77.1
Python Version
Python 3.10.4
Additional Context
No response
The text was updated successfully, but these errors were encountered:
@raphaelauv but I don´t direct a solution for my case in that PR. In the documentation of the PR I read something about supporting the same endpoint with different dependencies, that is OK, and I think is very important but in my case, I want to overwrite the endpoint.
I am doing something similar where I am making some plugins with their own routes and models. But I want whoever uses them to be able to extend the models and routes and update the routes. This would be super helpful!
First Check
Commit to Help
Example Code
Description
I copy here my thread in StackOverflow
So... I'm trying to create a simple pluggable FastAPI application where plugins can add, or not, API endpoints. Now is working fine so every plugin adds its own API endpoints. But what if a plugin can extend other plugins, to add or modify its endpoints...
For that, I build a plugin graph to handle the plugin dependencies and now a plugin can import the router from its dependencies and add some new endpoints. But I can´t overwrite the existing endpoints with the new routes.
I have also found an interesting thing in the generated API
/docs
that maybe can be a bug. The sample code generates this doc, which seems to be OK to me:But... the endpoint returns the wrong response:
At this point, I spect to have a
"hello world 2!"
response fromnew_index
not a"hello world!"
fromindex
Following a suggestion in the StackOverflow comment, I found this solution which I'm not happy with
I mean I'm not happy because I can´t find a good way to replace the route, since the
__eq__
to check if the route is in the list is onstarlette.routing.Route
so this was a simplest solution that I FoundOperating System
Linux
Operating System Details
Fedora 35
FastAPI Version
0.77.1
Python Version
Python 3.10.4
Additional Context
No response
The text was updated successfully, but these errors were encountered: