I’ve done a number of tutorials, but it is still a bit unclear to me what is the best practice regarding GraphQL and DQL.
This blog post is helpful (GraphQL vs DQL - Dgraph Blog) but it is rather vague around the specific limitations of GraphQL:
With this knowledge, it is easy to understand that anything that can be done in GraphQL can be done in DQL, but the opposite is not necessarily true. Some queries and mutations are possible in DQL that are simply not possible in GraphQL, mainly due to the restriction of the GraphQL specification itself being a strictly typed query language, and DQL being a loosely typed graph query language that can even work without a predefined schema.
It further suggests that DQL features go beyond the normal use cases of a front-end applications (which can be debated?) and that a primary use case for DQL is to have a secure internal API (which I wouldn’t argue against.).
GraphQL provides clients with a strictly controlled query and mutation endpoint that developers can tightly control while DQL provides developers with a more flexible graph query language to control their data in ways outside of the normal use cases of front-end applications.
but the developer can have an administration site that he alone has access to and can add in other related fields and data objects at will without being constrained by GraphQL syntax specifications.
Seeing this from the perspective of building a complex frontend app, my broad concern is that GraphQL schema development will become a complex abstraction over DQL schema when in fact our front-end application has quite extensive needs. Furthermore I see a risk in confounding frontend developers if it’s not clear from the outset which APIs to rely on as we build incrementally powerful helpers and fragments.
To give some context, in our use case we have about 1000 Types with various inverse relationships, language strings and so forth. Our frontend will depend on both simple and very complex queries against these 10M+ triples and I would much appreciate if you can confirm/deny/add guidance on the below 4 questions:
Confirm or deny 1
When running dgraph.Operation().setSchema() I was a bit surprised to not see any GraphQL schema generated, but I guess the default here is DQL … But my understanding is that I should be able to update the GraphQL schema and the DQL will be generated under the hood?
Confirm or deny 2
Will we then also be able to access ANY (!) advanced DQL functions (such as GroupBy, recursion) via Custom DQL? https://dgraph.io/docs/graphql/custom/dql/.
Confirm or deny 3
If we regularly use advanced DQL features like language fallbacks, aggregations and so forth, would it make sense (and is it even possible?) to do that via the GraphQL or would we be better of building on top of DQL only?
Confirm or deny 4
If we use DQL for querying (bypassing the GraphQL), would it still make sense for us to always update the schema via GraphQL (to at least get a standard GraphQL introspection experience for less complex needs)? Or does that limit our expressivity and we should go directly for DQL also schema-wise?
Thank you for any help!