This PR updates both the /gremlin FastAPI endpoint and related core logic in explorer.queries.query to make the typing more explicit. The allows for more detailed type checking with pyright and helps open up the possibility of generating OpenAPI documentation for this endpoint via FastAPI.
In order to do this, I had to add additional pydantic types to explorer.queries.query and introduce a new module containing a subset of the cytoscape.js data model.
In order to test that query.GremlinResult was still working, I had to implement a method for inserting edges into the graph (and related tests). This will hopefully serve as a basis for porting the ETL logic from etl to api as described in #42.
This PR updates both the
/gremlin
FastAPI endpoint and related core logic inexplorer.queries.query
to make the typing more explicit. The allows for more detailed type checking withpyright
and helps open up the possibility of generating OpenAPI documentation for this endpoint via FastAPI.In order to do this, I had to add additional pydantic types to
explorer.queries.query
and introduce a new module containing a subset of the cytoscape.js data model.In order to test that
query.GremlinResult
was still working, I had to implement a method for inserting edges into the graph (and related tests). This will hopefully serve as a basis for porting the ETL logic frometl
toapi
as described in #42.In addition to the unit tests I have also manually tested this with the front-end to ensure that it is compatible with the changes to the API (I made one small tweak to the cytoscape config (https://github.com/tweag/nixpkgs-graph-explorer/commit/77a20cf112c5ab39d38437732c72f44942083510).