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

Gateway should not work on individual data types, just on JSON. #49

Open
DawidNiezgodka opened this issue Jul 20, 2022 · 1 comment
Open

Comments

@DawidNiezgodka
Copy link
Contributor

DawidNiezgodka commented Jul 20, 2022

Consider the scenario in which a user wants to make a query according to the following:

type Query {
getPurchase(id: String): Purchase @topic(name: "purchase", keyArgument: "purchaseId")
}

with a concrete query being:

{
getPurchase(id: "abc")  {
    productId
    }
}

What happens behind the scenes, for example in QueryKeyArgumentFetcher.get():

  1. We retrieve the argument ("abc") from the DataFetchingEnvironment, which is JSON representation of the graphql schema,
  2. We fetch a value of a specific type (Double, Avro, Protobuf) from the DataFetcherClient,
  3. This value is then converted by the framework (which one?) to JSON and delivered to the client.

If we start and end up with JSON, we make unnecessary conversions. Thus, we might refrain from working with different data types (f.e., Double, Protobuf, Avro) in Gateway and work directly with JSON.

For this:
a) MirrorDataFetcherClient has to be rebuilt so that it does not work with TypeResolver<V> but with JSON,
b) MirrorClient should not receive a resolver that works on a given data type but simply on JSON.

Additionally, it might be considered to complete remove the generic V parameter from Gateway.

@DawidNiezgodka
Copy link
Contributor Author

Changes made in this issue do not involve SubsciptionFetcher and MultiSubscriptionFetcher.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

2 participants