@graphql, Please don’t. This spec is still a WIP and is overcomplicated to what we have already with Dgraph’s GraphQL API. Just look at how it handles field operators compared to how Dgraph does it. It is easier to build dynamic web applications by separating the field and operator into two separate pieces which improves API flexibility and schema reusability. And don’t even get me started with their weird syntax for connections… no thank you. Keep it simple please
Thanks for your opinion,
but let me kindly disagree on some points, and let’s hope our discussion will bring more attention and love from the dgraph team to graphql API
“This spec is still a WIP”
How you came to that conclusion? Prisma v1 implemented it and was partially implemented by others (e.g. Postgraphile) for years
“It is easier to build dynamic web applications by separating the field and operator”
totally agree with you, the dgraph way is a lot easier to follow and build a dynamic input for a filter on a search results page with multiple filters (color, price range, other attributes)
their weird syntax for connections
if you mean the connection with cursors it is not really “theirs”, it is the official graphql recommended(?) for pagination and used by relay
In my opinion OpenCRUD does a better job of unifying everything under one model instead of having 3 different nodes/calls for query, get, and aggregate and
it proves that it is possible to describe with GraphQL all those complex queries that are now available only in DQL, e.g. groupby with aggregations
It might be better to understand if the spec actually had an example on this and not just stating it was possible by the spec. 2.4.4 is incomplete spec IMHO. It is missing 126.96.36.199, 188.8.131.52, 184.108.40.206, 220.127.116.11 which is outlined but not documented, Which makes me wonder if instead of the 3 operations above if there are actually 4 operations and the 4th is just not exemplified in this poor excuse for a specification. userConnection would belong to some example missing in 18.104.22.168 and maybe there would also be a 4th query operation names usersAggregate that should be exemplified in the missing 22.214.171.124
This makes me wonder why the actually harder parts of the spec are missing maybe the spec is unfinished and not updated in the last 9 months because it was a failed project? Reminds me of the verbosity of trying to implement GraphQL with Relay. Dgraph is not Relay compliant in a broad sense, but does things better than Relay in a broader sense (globally unique uid).
On this topic, Relay is trying to fix the GraphQL implementations that are inefficient because they are layers on top of rdbms/non-graph no-sql dbs.
Relay handles the heavy lifting to ensure the data declared by your components is fetched in the most efficient way. For example, by deduplicating identical fields, and precomputing information used at runtime, among other optimizations.
Most all of these inefficiencies are handled natively by Dgraph without the need to really complicate the API and force the front-end to use fragments and add a nested node edge to every query.
The main parts missing right now in Dgraph’s GraphQL API compared to OpenCRUD are
“Mutations: Nested” (2.5.3) which is handled by Dgraph to add new but not update. There have been multiple conversations about this in this forum and this seems to be a controversial topic of what should and should not be allowed by an API. As Dgraph’s GraphQL API is all auto-generated it comes down to what the engineers decide on this matter.
Another aspect that seems somewhat complicated is OpenCRUD’s tree-modifiers that Dgraph handles with cascade and not/has filters.
And to counter your point with actual spec, again you stated:
Where Dgraph would generate the mutations
OpenCRUD would generate the mutations
And it is not even clear if createManyUsers is spec compliant. So instead of 3 mutation operations for a single type we would have 5-6 operations. So what was your point again? lol.
I believe the API is setup well to continue working with backwards compatibility with the options to expand in the areas it will need to grow.
Also I believe that as the official GraphQL spec expands that it will open more doors for Dgraph to do things that are not officially supported at this time, aka var blocks for one possibility. But I also think there is a potential to find areas to grow even within the official GraphQL spec such as I discussed on