I have created a content fragment that contains multiple fields, and I am trying to retrieve all of them using GraphQL. I want to like to avoid listing each field individually. For example if my content fragment has 20 fields, I want to extract and view all field values without specifying them one by one. Is there a way to achieve this? I attempted using an asterisk (*), but it did not work. I also tried GraphQL introspection, but that did not yield any results. Any suggestions?
{
testFragmentByPath(_path:"/content/dam/projects/en-us/1",variation:"master") {
item{
h1text
h2text
buttonText
}
}
}
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Mario248 ,
GraphQL by design is meant to be explicit about the fields. So you can't do something like 'select *' in graphql like we do in databases.
Here's a link explaining the same which goes into more details-https://productionreadygraphql.com/blog/2019-10-24-why-you-cant-select-all-fields-on-a-type-in-graph...
Hi @Mario248
In the GQL editor, it will not allow to query for the equivalent of (*)
You should specify the fields what is required to display in the final output
Hope this helps
Hi @Mario248 ,
GraphQL by design is meant to be explicit about the fields. So you can't do something like 'select *' in graphql like we do in databases.
Here's a link explaining the same which goes into more details-https://productionreadygraphql.com/blog/2019-10-24-why-you-cant-select-all-fields-on-a-type-in-graph...
Views
Likes
Replies