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

Add GraphQL Endpoint - REST handler to accept graphQL requests #16

Open
YANG-DB opened this issue Nov 3, 2022 · 1 comment
Open

Add GraphQL Endpoint - REST handler to accept graphQL requests #16

YANG-DB opened this issue Nov 3, 2022 · 1 comment
Assignees

Comments

@YANG-DB
Copy link
Member

YANG-DB commented Nov 3, 2022

What ?
Add GraphQL endpoint for receiving graphQL queries

Steps

First stage

  • Support 'Get Schema' request
{
  __schema {
    queryType {
      fields {
        name
      }
    }
  }
}

checkout https://docs.github.com/en/graphql/guides/introduction-to-graphql#discovering-the-graphql-api

@Swiddis
Copy link
Collaborator

Swiddis commented Nov 23, 2022

Had some discussion about the different handlers and their roles. The main takeaways are that there will be three primary endpoints:

  • The object store endpoint /object stores all parts that make up a GraphQL schema: types, queries, and inputs. Validation should ensure that the schema parts are all valid on their own: they will be composed into a full schema later. This is already implemented but missing validation.
  • The schema endpoint /domain stores GraphQL schemas. These are immutable compositions of objects, and allows the user to describe data and queries. An open question is if this will also contain logic to describe Schema-Index mappings or if that will be separate. Validation should be at the schema level.
  • The GraphQL endpoint /graphql will handle Queries, Mutations, and Subscriptions. This should act on top of a defined schema. The initial groundwork for this endpoint was laid in Add Skeleton for GraphQL Rest Endpoint #23. Validation should check against the target schema.

A big point is that GraphQL engines should be maintained in-memory to validate and execute queries. These are computed based on schemas. For consistency and validation, the schema objects should be immutable once created, so updating a schema should involve an explicit create-migrate-delete process. To manage and cache engines, a special manager object should be written later.

Some short-term future work is to add functionality to:

  • Be able to configure the plugin to use a specific schema.
  • Be able to configure the plugin to handle a simple data ingestion use case.
  • Define better separation in-code between physical data storage and logical query representation.

Another open question for later is what internal representations to translate to, in order to execute queries. The main choices are DSL and SQL. DSL has the advantage of being the native OpenSearch format but has relatively limited functionality making representation generation harder. SQL is more flexible and ubiquitous, but it's likely to involve more work upfront. The two have similar performance.

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

No branches or pull requests

2 participants