timqian / gql-generator

Generate queries from graphql schema, used for writing api test.
MIT License
374 stars 93 forks source link

Support extend type #19

Open guzmo opened 5 years ago

guzmo commented 5 years ago

Hi,

We have modularized our graphql in to separate files so we extend the queries and mutations, eg.

extend type Query {
  someQuery: Boolean
}

Would it be possible to support this?

timqian commented 5 years ago

I have not tried the extend feature yet. But this tool use graphql-js to parse schema file, as long as graphql-js support it, gql-generator should support it too. But you might need to concat your schemas to one file as gql-generator does not support multiple schema files now

guzmo commented 5 years ago

Currently im pushing all to one file and then I run your tool on that file. But the only queries/mutations I get are the ones in the regular Query and Mutation type, not from the extended ones.

timqian commented 5 years ago

We use buildSchema method of graphql-js and seems graphql-js is still implementing it

https://github.com/graphql/graphql-js/issues/922#issuecomment-493732844

it ignores extend for now, and seems it will support it soon.

timqian commented 5 years ago

We can add extend support as long as graphql-js support it. PR is welcomed if I forget do it on time