Open arahansen opened 7 years ago
For my project, I don't always have the *.gql schema types available locally, but I'm able to grab the introspection query json.
You can always convert introspection query json to schema.graphql
import { printSchema, buildClientSchema } from 'graphql';
const schema = printSchema(buildClientSchema(introspectionQueryJSON));
// write schema to schema.graphql and use it
I'd be happy to take a look at adding support if I could maybe get pointed in the right direction for where to start digging in!
The support was intentionally not added as this package also support writing schema files and I do not want to complicate .gqlconfig structure.
Was there ever support added for this? I think it would be extremely nice to have.
I don't know what graphql version the previous comments were referring to, but the proper command for at least graphql@0.13.2 is:
import { printSchema, buildClientSchema } from 'graphql';
const introspectionQueryJSON = //getitfromsomewhere...
const schema = printSchema(buildClientSchema(introspectionQueryJSON));
// not introspectionQueryJSON.__schema
// write schema to schema.graphql and use it
the __schema
property is accessed from within buildClientSchema
.
@ndonnellan Thanks, I have fixed the comment.
I was wondering if its possible to expand the functionality of this tool to be able to ingest an introspection query json similar to how eslint-plugin-graphql handles validation.
For my project, I don't always have the
*.gql
schema types available locally, but I'm able to grab the introspection query json.I'd be happy to take a look at adding support if I could maybe get pointed in the right direction for where to start digging in!