Score:1

graphql mutations, how to create link field?

zw flag

I am following this guide. https://drupal-graphql.gitbook.io/graphql/mutations/mutations

I have created a module and with a plain text field I can run

mutation {
  createArticle(data: { title: "https://google.com" }) {
    ... on Article {
      id
      title
    }
  }
}

And it creates an article with title https://google.com.

Now I am trying to add a link field. I have updated the module to write to a link field. I run below

mutation {
  createArticle(data: { link: "https://google.com" }) {
    ... on Article {
      id
      link
    }
  }
}

But link returns empty.

How can I make the mutation write to the link field?

Thanks

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.