Support for wildcard expanding all available fields #3809
Replies: 7 comments
-
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.
-
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
*
and then autocompleted with all available fields. For example, when I type:{ user { * } }
If
user
contained4
fields I would want GraphiQL to autocomplete and fill in the query as:Beta Was this translation helpful? Give feedback.
All reactions