Fancy this GraphQL query?

leoloso profile image Leonardo Losoviz ・1 min read
mutation {
  comment(id: 1) {
    replyToComment(data: data) {
      id @sendEmail(
        to: "{{ parentComment.author.email }}",
        subject: "{{ author.name }} has replied to your comment",
        content: "
          <p>On {{ comment.date(format: \"d/m/Y\") }}, {{ author.name }} says:</p>
          <blockquote>{{ comment.content }}</blockquote>
          <p>Read online: {{ comment.url }}</p>

It has a few pioneering features, still being considered (to more or less extent) for the GraphQL spec:

πŸ”₯ Nested mutations
πŸ”₯ Embeddable fields (based on composable fields)
πŸ”₯ Flat chain syntax

If I get the funding, I will implement this feature (among many others) for WordPress plugin GraphQL API for WP.

What do you say?


Editor guide
sharmarajdaksh profile image
Dakshraj Sharma

I definitely would appreciate practical nested mutations. I feel that nested mutations could help make better understandable schemas, compared to the current case where all mutations need to live at the schema root, without any kind of grouping or hierarchy being possible.