Support for wildcard expanding all available fields #3809
-
Sometimes I would like to see all the data and all fields available, without having to list all of them. In this case, it would be nice if GraphiQL supported me typing {
user {
*
}
} If {
user {
id
name
location
created_at
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 3 replies
-
Related to graphql/graphql-spec#127, but we don't actually need wildcards in the query protocol... only in the GraphiQL client. |
Beta Was this translation helpful? Give feedback.
-
this used to work in it may be that this is somehow incompatible with the latest version of codemirror. this is even customizeable via the getDefaultFieldNames prop
I started with an experiment of adding this to I'm considering proposing this completion option as well: |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
The Working |
Beta Was this translation helpful? Give feedback.
-
ok, typing a number seems to work |
Beta Was this translation helpful? Give feedback.
-
One more... for filters, using a parenthesis seems to work, it has to be empty, so you often have to delete your current filter to get the whole list again. So only when you type |
Beta Was this translation helpful? Give feedback.
-
I will make a guide to this soon, as it's much easier to auto expand and fill leafs than this, and the getDefaultFieldNames prop callback allows you to endlessly customize this, to the point of allowing you to enable auto-expansion of all fields. it's just a matter of knowing the keyboard shortcuts and how to customize!
as you can see, if you remove the condition on line 113, you have a recipe for auto-expanding all leafs, something like this maybe: function myCustomGetDefaultFieldNames(type: GraphQLType) {
// If this type cannot access fields, then return an empty set.
// if (!type.getFields) {
if (!('getFields' in type)) {
return [];
}
const fields = type.getFields();
// Include all fields.
const leafFieldNames: Array<string> = [];
for (const fieldName of Object.keys(fields)) {
leafFieldNames.push(fieldName);
}
return leafFieldNames;
}
<GraphiQL getDefaultFieldNames={myCustomGetDefaultFieldNames} /> these are all part of the original |
Beta Was this translation helpful? Give feedback.
I will make a guide to this soon, as it's much easier to auto expand and fill leafs than this, and the getDefaultFieldNames prop callback allows you to endlessly customize this, to the point of allowing you to enable auto-expansion of all fields. it's just a matter of knowing the keyboard shortcuts and how to customize!
shift + space = expand autocompletion anywhere (also ctrl+space, windows+space and cmd+space works for this)
once a field name is completely typed out, type cmd/windows + enter to auto-expand relay-esque defaults as per the default
getDefaultFieldNames
prop value (note this default callback value may move for 4.x). there is a bug from the 2.x rewrite that causes it to…