Skip to content

Latest commit

 

History

History
70 lines (50 loc) · 3.93 KB

README.md

File metadata and controls

70 lines (50 loc) · 3.93 KB

Hasura GraphQL Connector

Docs Latest release License ndc-hub

The Hasura GraphQL Connector allows for connecting to a GraphQL API and bringing it into Hasura DDN supergraph as a single unified API. It can also be used to bring in your current Hasura v2 graphQL API into Hasura DDN and our recommended approach is to create a new subgraph for the v2 API.

For Hasura v2 users, this functionality is the replacement of remote schemas functionality in v3 (DDN).

This connector is built using the Rust Native Data Connector SDK and implements the Native Data Connector Spec.

The connector translates the root-fields of a GraphQL schema to NDC functions and procedures. This results in your GraphQL root-fields being exposed as commands in the Hasura supergraph. This simplifies implementation and acts as a proxy more than a model.

The recent support for field arguments and header forwarding on Hasura v3 engine allow the connector to represent the majority of queries and mutations.

flowchart LR
    User ---|GraphQLRequest| Engine
    Engine ---|NDCRequest| Connector
    Connector ---|GrqphQLRequest| UpstreamGQL
    Admin --- CLI
    CLI --- Plugin
    Plugin ---|Introspection| UpstreamGQL
    CLI -->|Configuration| Connector
Loading

The connector is configured in plugin mode, then run in execution mode.

Header forwarding is implemented as additional command arguments and wired from headers to the argument by the engine via the new ArgumentPresets feature.

Features

Below, you'll find a matrix of all supported features for the GraphQL connector:

Feature Supported Notes
Queries All features that v3 engine currently supports
Mutations
Header Passthrough Entire headers can be forwarded
Subscriptions
Unions Can be brought in via scalar types
Interfaces
Relay API
Directives @cached, Apollo directives

Other Considerations and limitations

  • Error formatting
    • The format of errors from the connector does not currently match V2 error formatting
    • No "partial error" or "multiple errors" responses
  • Pattern matching in request header forwarding configuration
    • This uses simple glob patterns
    • More advanced matching and extraction is not currently supported
  • Response headers only allow at most one header per name
    • For example you may only use one Set-Cookie response header

Using the GraphQL Connector

This connector should be used with Hasura DDN. Please see the relevant documentation.