-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DSL: Compose query with all nested fields included #316
Comments
After sleeping on this I realize this wish for "all the data in one simple shot" goes quite against the principles of GraphQL with it's declarative nature. Especially considering this technology emerged from the limitations of REST. So a possible solution to this might not be that easy, but the Although I will certainly take advantage of this declarative approach, I would still be very happy if there was a way to sort of get "every bit of information" out of a schema. Sometimes I encounter schemas containing a lot of queries, types and fields with ambiguous documentation, so in order to figure everything out it would help to get all the data I have access to. The actual data. Writing out every type, field name and every single child manually in such a situation is a horrible task I'd like to avoid. |
Not out of the box, but you can definitely do it yourself by analyzing all the possible children fields of each field in the schema.
The only way to prevent it would be to provide a limit of nesting levels but you need to understand that even in that case, the quantity of results might completely explode very fast even with few levels.
If I recall correctly, it is used for lists and for non-nulls (!), in that case a type is linked to an inner type.
Yes, that's redundant as all the introspection data is already present in the schema you have.
I completely understand and we might want to provide a |
Also you could take a look at the get_introspection_query_ast method which uses the DSL module to create an introspection query with the number of nested levels of your choice (in that case the fields are known, tough) |
Okay, I see! Yes, a I will explore this further. Thanks for your input, much appreciated! 👍 |
I would greatly appreciate this |
Hello!
I'm building my query dynamically. I want to select all the nested sub fields (children, grand children etc). Is there a way to accomplish this with
gql
?I'm not very fluent in graphql but I do know it's possible to build infinite nested queries, so is it even possible/easy to prevent that from happening?
I've experimented with looping through
ds.Content._type.fields
to somehow select each field and any children they might parent. But I find it confusing as some objects containsof_type
attribute while others do not and I don't know why that is.Might I be better off doing an introspection with
and determine any children by simply parsing the json data? Seems redundant.
The text was updated successfully, but these errors were encountered: