Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Example for recursive object creation / reference fields

Open
#6 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
graphql, php

Research direction

Start by reviewing the linked graphql README and example repositories, then compare their mutation and nested-reference documentation with the requested A/B schema. Document a concrete recursive creation example showing the input, mutation, and returned distinct Drupal objects; verify that the example covers both nested fields and created IDs.

Written by the indexing model from the issue text.

Description

Could you please provide an example for a mutation that recursively creates an object? On the Drupal side we expect the "A" bundle to contain a field referencing the "B" bundle.

Expected usage from the GraphQL side:

type B {
  z: String
}
type A {
  b: B
}
input BInput {
  z: String
}
input AInput {
  b: BInput
}
mutation CreateA($a: AInput) {
  createA(a: $a) {
    id
    b {
      id
      z
    }
  }
}

Note that XXXInput has the exact same structure and types as XXX.

With $a = { b: { z: "example" } } it should return { id: 1234, b: { id: 3456, z: "example" } } (e.g.). In particular, A and B should be created as distinct Drupal nodes.

We already had a look at the following resources, but without finding examples for anything but the most simple cases:

Dominant language
PHP
Stars
12
Forks
6
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from drupal-graphql/graphql-examples

All issues in drupal-graphql/graphql-examples

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.