4 ms·
We're thinking of adding a "add all" checkbox in the explorer for this exact reason - feel free to open an issue https://github.com/OneGraph/graphiql-explorer/i
by sgrove 8y ago
We're thinking of adding a "add all" checkbox in the explorer for this exact reason - feel free to open an issue https://github.com/OneGraph/graphiql-explorer/issues https://github.com/OneGraph/graphiql-explorer/issues so we can discuss it further.
There are obviously tradeoffs that come with selecting all fields by default (in particular it makes it difficult for the server devs to send thoughtful notifications only to clients who rely on specific fields when necessary), but for initially exploring it's definitely nice.
- sbr464 8y agoThinking about a solution, to stay within the "graphql way", I was thinking of doing this: 1. Send introspection queries[1] to get the schema. 2. Iterate over the results, building a query object with all of the non deprecated fields. 3. Store the results in a db or cache for later queries. 4. Send the request as normal with the full query. https://graphql.org/learn/introspection/ https://graphql.org/learn/introspection/ [1] Example introspection query: query { __schema { types { name kind } } } query { __type(name: "YourTypeName") { name kind fields { name type { name kind ofType { name kind } } description isDeprecated deprecationReason } } }
- sbr464 8y agoSaw there was a library from OpenTable[1] that generated queries from introspection: [1] https://github.com/opentable/graphql-query-generator https://github.com/opentable/graphql-query-generator