'Can Introspection be used to make create/stitch dynamic GraphQL queries?

I am currently using GraphCMS where we query the client in order to get json data response.

I am trying to stitch the query so we can possibly have dynamic queries in place. If i know the schema name using a query like below

{__type(name: "CustomPage") { fields { name type { name kind ofType { name kind ofType { ofType { name possibleTypes { name } } } } } } } }

I get all the possible types, and if that has an object I use the same query with the name of that object and so on.

But graphCMS also has the possibility of having lists and having those creates a reference in the component addressed, Does it make sense to have dynamic query builder because, it could lead to an infinite loop.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source