graphprotocol / graph-client

The Graph library for building GraphQL-based dapps in a decentralized way.
MIT License
174 stars 44 forks source link

Allow Specifying Data Source for Query #337

Open frankfka opened 1 year ago

frankfka commented 1 year ago

Hello!

Is it possible to specify the particular data source to query for a given query? I have two graphs with identical schemas. However, for a certain query, I would like to make sure that I'm hitting one particular endpoint.

I assume that this can be done with composition - but can't find an example for doing so.

And in general, is there a good resource to see how to write the .yml file?

matthewlilley commented 1 year ago

@frankfka you might find something useful within our graph client package here:

https://github.com/sushiswap/sushiswap/blob/master/packages/graph-client/__tests__/pairs.test.ts

We do a lot of multichain queries, and chain specific queries for the same graphs.

frankfka commented 1 year ago

@matthewlilley Thanks! Is there a good way to find docs for the yaml file, so that we can actually understand what the configuration does? For example, I couldn't find good documentation for addSourceName: https://github.com/sushiswap/sushiswap/blob/master/packages/graph-client/.graphclientrc.yml#L96

matthewlilley commented 1 year ago

@matthewlilley Thanks! Is there a good way to find docs for the yaml file, so that we can actually understand what the configuration does? For example, I couldn't find good documentation for addSourceName: https://github.com/sushiswap/sushiswap/blob/master/packages/graph-client/.graphclientrc.yml#L96

For graph client specific packages, probably best to just look at the packages within this repo, the config itself is a graphql mesh config.

https://github.com/Urigo/graphql-mesh/blob/master/packages/types/src/config.ts

dhruv035 commented 1 year ago

I cant find this option either, I would like a query to run only against 1 of the sources in the .yaml file, is there a way to do that with graphclient?