fastapi-jsonrpc icon indicating copy to clipboard operation
fastapi-jsonrpc copied to clipboard

Allow using routers to split the code

Open Smlep opened this issue 4 years ago • 3 comments

Hi,

Fastapi offers a router functionality detailed here. It can be really useful to split the methods into many files.

It would be nice to be able to do the same things with the JSONRPC methods. Currently, since Entrypoint inherits from fastapi's APIRouter, trying to bind another Entrypoint with the same path won't allow access to the methods from the second Entrypoint.

There should be a way to bind 2 Entrypoint with the same path to one app, allowing both of their methods to be considered.

Really great library btw, good work!

Smlep avatar Apr 14 '21 20:04 Smlep

I can work on this and submit a PR, but first I wanted to know if this was relevant and if I hadn't missed an obvious way to do it.

Smlep avatar Apr 14 '21 20:04 Smlep

Hi! Yea, here is no way to make it

I'm using app.include_router to add routes to Swagger from other FastAPI application, but this does not work for fastapi_jsonrpc.API object.

I hope it can be easly fixed.

spumer avatar Apr 17 '21 15:04 spumer

And i think re-bind with same path it's bad idea. We should use include_router logic as described in fastapi link you posted above

spumer avatar Apr 17 '21 15:04 spumer

Split across files

https://github.com/smagafurov/fastapi-jsonrpc/pull/28#issuecomment-1001257343

spumer avatar May 17 '23 08:05 spumer