gql-generator
gql-generator copied to clipboard
Using programmatically
Thanks for writing this.
Is there a way to use this programmatically instead of writing files?
I would love to use this tool + https://github.com/marak/Faker.js to use the field types in the schema to generate a query with random data :)
This tool generates general queries accepting variables
as the query argument. In your case, you can generate random data as the variables.
However, this tool did not tell you what the possible variables a query accepts, you might need to get this info by other ways.
What Sam is asking about is whether there is a way of generating and running the queries on-the-fly instead of writing to files first and then importing. I imagine there is no easy way to do so now, but it shouldn't be too hard to add that option.
For reference, I ran into the same question and I adopted the code so queries can be generated programmatically. Moreover, it runs with more clever arguments dedupe algorithm (symbol23 -> amar_symbolB) and request fields might be customized (useful with fragments resolvers). https://github.com/Skitionek/gql-generator-node