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

Save Schema if pulled from URL #140

Closed
joshstrange opened this issue Mar 23, 2018 · 5 comments
Closed

Save Schema if pulled from URL #140

joshstrange opened this issue Mar 23, 2018 · 5 comments
Labels

Comments

@joshstrange
Copy link

Is there anyway currently (or would it be hard to implement) to have the schema pulled via URL saved into the schema file? My problem is that my graphql endpoint requires authentication (api token) the expires every hour. This means that if I check out my code in a new location I need to grab a new token and plop it down in the headers in the config file so that the plugin stops complaining about my queries not being valid.

I can write a script to grab a token and throw it into the config file (for when my schema changes) but I would love it if when you first checkout code it would use the last fetched (and committed to git) schema.

@fetis
Copy link

fetis commented Jun 25, 2018

This would be nice. In general, authorization topic is not well covered in the plugin. So would like to have a prompt or local variable to provide a token for authorization. #72 relates to this issue.

@fetis
Copy link

fetis commented Jun 26, 2018

as a temporary workaround, I can suggest a solution to use
apollo-codegen introspect-schema to get the schema and story it as .json. You can specify auth header in this command. The plugin must be configured to get the schema from a local file. This works for my case.

Another thing, locally stored schema also can be used for types generation from a schema. So it's not only auth about.

@joshstrange
Copy link
Author

Thanks, I ended up just writing a script that would have auth and download of schema file and switched over to using file instead of URL-based fetching. https://gist.github.com/joshstrange/3130d1edf0b414b997f75219defc9da6

@jimkyndemeyer
Copy link
Collaborator

See https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/releases/tag/2.0.0-alpha-3

There is now an "Execute introspection query and print GraphQL SDL" line marker next to endpoint urls which saves the schema to the schemaPath configured in the .graphqlconfig.

@jimkyndemeyer
Copy link
Collaborator

Hi Josh.

See remote-schema-introspection for how v2 of the plugin supports your use case. You can specific API tokens via environment variables in the .graphqlconfig file as described in the graphql-config documentation.

If you'd like to help test v2 the releases are found at https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/releases

Best regards,
Jim.

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

No branches or pull requests

3 participants