[Meta] Support for GraphQL mutations

Created on 4 July 2024, 5 months ago
Updated 2 September 2024, 3 months ago

Problem/Motivation

The simple question is: does this module support mutations out of the box?

There is a mutation for Comments (see CreateComment.php) available but not for Nodes or other entity types. Not sure if the Comment mutations are used as a PoC or not.

So, to summarize my questions:

1) What is the plan with Mutations?
2) Is it a functionality provided by another module so we do not bother on this module?
3) Is there a ready to use Plugin/Class etc on this module we could extend to create Mutations?

Proposed resolution

Create built-in Mutations per entity type (similar to the Queries).

πŸ’¬ Support request
Status

Active

Version

2.2

Component

Code

Created by

πŸ‡¬πŸ‡·Greece TheodorosPloumis Greece

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @TheodorosPloumis
  • πŸ‡¦πŸ‡ΊAustralia almunnings Melbourne, πŸ‡¦πŸ‡Ί

    Hey, cool chat prompt!
    I'm a "write as I think" kind of responder, so forgive me if I ramble.

    Mutations are a bit of a clean slate right now.
    The comments mutation was a start at it, but it was just to compliment the comments module.

    I often found myself torn in two states of mind about starting any deeper integration.

    Most of my use cases for writing content back to Drupal have been ad-hoc or really specific. The most useful one I can think of, which I haven't got here is webforms.

    I've not yet felt the burning desire to go and create nodes and the node content ui in a headless ui.

    If we were to address generic entity mutations, it would be pretty generic, and possibly limited by the nested complexity horrors of things like paragraphs.

    Theres also the suggestion that you can just write your mutations in graphql without compose, and you can leverage the compose types for returning content.

    I've got a sample module on a repo that I gave someone in Slack.

    https://github.com/almunnings/drupal-graphql-sample-mutation

    My personal opinion is yes to webforms, and yes to basic entity/fields, and "oh lordy" to extended contrib support.

    Do we have any good examples of mutations for nested entity structures (like paragraphs) written by anyone else? Something we could leverage as best practice? I feel like I'd just wing it with some data producer mapped monster.

  • πŸ‡ΊπŸ‡ΈUnited States jmolivas El Centro, CA

    I kinda like the idea of mutations, this could be a separated submodule graphql_compose_mutations we definitely need to make sure we take care in a careful way to avoid the data producer monster.

  • πŸ‡¬πŸ‡·Greece TheodorosPloumis Greece

    I do have a ready mutations module (with exactly that name) but I need some time to create the PR.
    In fact, I do have many other submodules I created based on the graphql_compose module but need some work to make them at least ready for review.

  • πŸ‡ΊπŸ‡ΈUnited States jmolivas El Centro, CA

    What other submodules and which features are you working on theodorosploumis?

  • πŸ‡¬πŸ‡·Greece TheodorosPloumis Greece

    Here are the modules we are working on. The most interesting are the debug, file_upload, mutations, logout, register, reset_password. The other ones are are self explained. They simply entity related with some minor customizations and extensions on fields.

    - graphql_compose_activities
    - graphql_compose_debug
    - graphql_compose_files
    - graphql_compose_file_upload
    - graphql_compose_flaggings
    - graphql_compose_logout
    - graphql_compose_messages
    - graphql_compose_mutations
    - graphql_compose_posts
    - graphql_compose_private_messages
    - graphql_compose_profiles
    - graphql_compose_register
    - graphql_compose_reset_password

Production build 0.71.5 2024