graphiql
graphiql copied to clipboard
Plugin: keyboard shortcut to add all fields
Related: https://github.com/graphql/graphiql/issues/75
I would love to see a button, or a key combination that will add/autocomplete all direct fields of the current object. Complex fields will be autocompleted to {}, that will need to be manually fileld out.
Example:
Type Person with fields id, name, groups, teams
Type Group with fields id, name, people
Type Teams with fields id, name, people
Typing
query {
people {
<MAGIC KEY COMBINATRION>
}
}
becomes
query {
people {
id
name
groups(page: null , page_size: null) {
}
teams(page: null , page_size: null) {
}
}
}
Also plus if the complex subtypes are added at the end
Another possibility is to have an "add all" in the autocomplete dropdown.
@axos88 That would be a cool feature and something I have thought of myself!
https://github.com/imolorhe/altair
this would be cool! Altair is a great tool that uses our codemirror-graphql mode and accomplishes this readily.
FWIW, there is a shortcut for automatically adding all required fields for an object type. just type in the name of the field, and before adding brackets, just hit enter, and youll see it automatically add all the required fields for that object. voila!
@FluorescentHallucinogen has some nice ideas on the UX for this too!
@FluorescentHallucinogen has some nice ideas on the UX for this too!
Yep, see https://github.com/prisma/graphql-playground/issues/683#issuecomment-464465807 (first iteration) https://github.com/prisma/graphql-playground/issues/683#issuecomment-464845224 (improved) https://github.com/prisma/graphql-playground/issues/683#issuecomment-477032683 (final vision)
The only thing that may not clear from my last image (final vision) is the "Insert all fields" and "Insert required fields" items are clickable, aren't just static tips.
Please also take a look at https://github.com/imolorhe/altair/issues/753.