Skip to content

Preserve isOneOf in BuildClientSchema - #2005

Open
radmen wants to merge 1 commit into
webonyx:masterfrom
radmen:fix/build-client-schema-is-one-of
Open

radmen wants to merge 1 commit into
webonyx:masterfrom
radmen:fix/build-client-schema-is-one-of

Conversation

@radmen

@radmen radmen commented Nov 13, 2026 •

Copy link
Copy Markdown

The problem

I'm trying to integrate the Shopify GQL introspection proxy (https://shopify.dev/admin-graphql-direct-proxy/2026-10) for one of our tools.

It's using the following query to get the introspection:

Introspection::getIntrospectionQuery([
    'descriptions' => true,
    'directiveIsRepeatable' => false,
    'schemaDescription' => false,
    'specifiedByURL' => false,
    'typeIsOneOf' => false,
])

Turns out, the isOneOf is not propagated to the InputObjectType. It is in the JSON response, but the object doesn't receive it.

I made this fix with the help of the AI. Please let me know if there is something I should fix.

Reproduction script

  <?php declare(strict_types=1);

  // Usage: php repro.php /path/to/graphql-php
  require $argv[1] . '/vendor/autoload.php';

  use GraphQL\Type\Introspection;
  use GraphQL\Utils\BuildClientSchema;

  $query = Introspection::getIntrospectionQuery(['typeIsOneOf' => true]);

  $response = file_get_contents('https://shopify.dev/admin-graphql-direct-proxy/2026-10', false, stream_context_create([
      'http' => [
          'method' => 'POST',
          'header' => 'Content-Type: application/json',
          'content' => json_encode(['query' => $query]),
      ],
  ]));

  $introspection = json_decode($response, true, flags: JSON_THROW_ON_ERROR)['data'];

  $fromShopify = array_column($introspection['__schema']['types'], 'isOneOf', 'name')['ProductIdentifierInput'];
  $schema = BuildClientSchema::build($introspection);

  echo 'Shopify sends isOneOf: ', var_export($fromShopify, true), PHP_EOL;
  echo 'Built schema isOneOf:  ', var_export($schema->getType('ProductIdentifierInput')->isOneOf(), true), PHP_EOL;

Changelog

Fixed

  • Preserve isOneOf on input object types built with BuildClientSchema::build()

Co-Authored-By: Agent <agent@nonhuman.work>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant