Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate /gremlin API endpoint in favor of a dedicated /graph endpoint #128

Open
dorranh opened this issue Jun 27, 2023 · 1 comment
Open

Comments

@dorranh
Copy link
Contributor

dorranh commented Jun 27, 2023

The original functional spec for this application included the ability for users to submit ad-hoc queries via the Gremlin query language. Following user feedback which indicated that this query language was not easy to use and not particularly useful for core use-cases, UI support for such queries has been dropped in #121. However, we continue to use the same API endpoint which was designed for this feature to power the graph visualization in the UI, having the web client generate Gremlin query strings and submit them to the API for evaluation.

This approach introduces a lot of unnecessary baggage such as requiring the web client to be "Gremlin-aware" as well as exposing a public endpoint which we do not intend to support moving forward. Additionally, it is quite error prone when used for populating the graph visualization since it involves a lot of unnecessary wrangling. For example, the evaluation looks something like:

flowchart TD
    id1([1. Browser issues Gremlin query to /gremlin endpoint])
    id2([2. API validates query, submits to Gremlin Server])
    id3([3. Gremlin Server further validates query, permissions, etc.])
    id4([4. Gremlin Server evaluates query and returns results])
    id5([5. API parses results, attempting to detect whether a renderable result was generated and returning a CytoscapeJS-compatible object if possible])
   id6([6. Client parses the API response, rendering CytoscapeJS data if is available])
   id1 --> id2
   id2 --> id3
   id3 --> id4
   id4 --> id5
   id5 --> id6
Loading

I would propose that we add a dedicated /graph endpoint which always returns a response which can be used for populating the graph visualization. This will help reduce the wrangling happening in the above logic and should also allow us to provide a more reliable implementation for fetching dependency graphs. It will also allow us to perform optimizations in the endpoint's implementation to help ensure the efficiency of the Gremlin traversals it generates.

@GuillaumeDesforges
Copy link
Contributor

That's a very good point. Indeed it'll be much easier to work on the Gremlin queries on the api side with the proper types and libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants