Automattic\WooCommerce\Vendor\GraphQL\Utils

SchemaPrinter::hasDefaultRootOperationTypesprotected staticWC 1.0

Automattic\WooCommerce\Vendor\GraphQL schema define root types for each type of operation. These types are the same as any other type and can be named in any manner, however there is a common naming convention:.

  schema {
	query: Query
	mutation: Mutation
	subscription: Subscription
  }

When using this naming convention, the schema description can be omitted. When using this naming convention, the schema description can be omitted so long as these names are only used for operation types.

Note however that if any of these default names are used elsewhere in the schema but not as a root operation type, the schema definition must still be printed to avoid ambiguity.

Method of the class: SchemaPrinter{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = SchemaPrinter::hasDefaultRootOperationTypes( $schema ): bool;
$schema(Schema) (required)
.

SchemaPrinter::hasDefaultRootOperationTypes() code WC 11.0.1

protected static function hasDefaultRootOperationTypes(Schema $schema): bool
{
    return $schema->getQueryType() === $schema->getType('Query')
        && $schema->getMutationType() === $schema->getType('Mutation')
        && $schema->getSubscriptionType() === $schema->getType('Subscription');
}