Hi guys,
While researching type/schema validation system in GraphqL, found out that our mutations format (RDF nquads) is different from how GraphQL spec describes mutations.
Dgraph:
mutation{
set{
<jedi> <stars> "5" .
<jedi> <commentary> "This is a great movie!" .
}
}
GraphQL:
mutation CreateReviewForEpisode($ep: Episode!, $review: ReviewInput!) {
createReview(episode: $ep, review: $review) {
stars
commentary
}
}
{
"ep": "JEDI",
"review": {
"stars": 5,
"commentary": "This is a great movie!"
}
}
Major difference is Graphql takes in separate arguments for data changes while we conform to the RDF format.
Prime reason for having same format for query and mutations I think are (among other reasons GraphQL team might have):
- It’s convenient.
- It encourages use of single parser/validation mechanism for queries and mutations.
Had this discussion earlier about whether it will be beneficial for us to change Dgraph’s format to GraphQL’s mutation format, so making this post to take it further.
I think that our current system works good and we can introduce the minimal type/schema system without changing it. GraphQL spec tightly couples the query language with internal implementation which we do not really want or need.
Keeping the implementation as it is:
- Will probably make supporting few GraphQL features like introspection a bit tricky but it shouldn’t be a blocker.
- For users trying out dgraph through GraphiQL (for mutations), it might be an issue.
What do you guys think? Please post your thoughts here.
PS: We already had some kind of pin in roadmap for supporting multiple mutations here but trello link is gone now.