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 config for remote schemas #207

Open
cameronbrill opened this issue Jun 11, 2022 · 5 comments
Open

Add config for remote schemas #207

cameronbrill opened this issue Jun 11, 2022 · 5 comments
Labels
enhancement New feature or request help wanted Issues that anyone could pick up and implement if useful to them

Comments

@cameronbrill
Copy link

cameronbrill commented Jun 11, 2022

Is your feature request related to a problem? Please describe.
I don't want to have to manually update the schema.graphql file.

Describe the solution you'd like
Add RemoteSchemaURL to generate/config.go. Temporarily download this file to disk for generation.

Describe alternatives you've considered
I currently have a ci job to download the remote schema and compare it to the schema in my project

@cameronbrill cameronbrill added the enhancement New feature or request label Jun 11, 2022
@benjaminjkraft benjaminjkraft added help wanted Issues that anyone could pick up and implement if useful to them needs design Issues where we don't know exactly what we need yet; discuss on the issue before implementing and removed needs design Issues where we don't know exactly what we need yet; discuss on the issue before implementing labels Aug 20, 2022
@benjaminjkraft
Copy link
Collaborator

I see a bunch of thumbs up here -- thanks for filing the issue and for those who expressed interest.

It should be easy enough to do a simple version of this (PRs are welcome or I may have time eventually), but my question is whether that's enough. For those who were interested, is just fetching the file from a fixed URL as a GET with no auth sufficient for you, or would you also need a way to configure the fetch further?

cc @connec @reiishikawa1208 @lzakharov @Diaga @wdoug

@Diaga
Copy link

Diaga commented Aug 24, 2022

For my use case, I would need to specify custom headers for auth and specifying user roles. Specifying method GET/POST may also be needed.

Here is what I am used to in JS environment:
https://www.graphql-code-generator.com/docs/config-reference/schema-field#method
https://www.graphql-code-generator.com/docs/config-reference/schema-field#headers

@skandragon
Copy link

I would also love to see this feature. My use case is I have a running Dgraph database, which has a running (and Dgraph augmented) schema. This includes many mutations and queries. The issue is pulling this from the local dev dgraph install, which is my problem to set up of course.

I can use the npm tool get-graphql-schema http://10.45.220.6:8080/graphql to fetch it in the proper format, of course.

@benjaminjkraft
Copy link
Collaborator

@Diaga thanks for the links to the JS version, that will be a helpful reference!

@skandragon if you're fetching from a local install, is that on a fixed IP/port? Is that SDL format or introspection query? I think supporting via introspection query is going to be a fair amount of work, because we'd have to implement the transform in Go. If someone wants to do it (or better if there's a package we can pull in), that would be great, but I expect fetching SDL will be the first step.

@skandragon
Copy link

@skandragon if you're fetching from a local install, is that on a fixed IP/port? Is that SDL format or introspection query? I think supporting via introspection query is going to be a fair amount of work, because we'd have to implement the transform in Go. If someone wants to do it (or better if there's a package we can pull in), that would be great, but I expect fetching SDL will be the first step.

What I really want is a way to take the SDL format input, and have what dgraph would use as output, on the command line.

My work flow is currently:

  • submit the schema to dgraph via a POST to /admin
  • get the schema back via the npm tool get-graphql-schema and write it to a file.
  • run the Go tool go run github.com/Khan/genqlient to generate graphql code for my Go app

I cannot feed the user-side schema I write to genqlicent, as it will not have all the components needed.

I cannot feed the user-side + dgraph fragment for IDEs in, as that won't generate the queries or mutations.

So, my option is to submit to dgraph, and pull the resulting full schema out. I'd really just like to do that without running dgraph, although I will then run dgraph for my unit tests of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Issues that anyone could pick up and implement if useful to them
Projects
None yet
Development

No branches or pull requests

4 participants