Automattic\WooCommerce\Vendor\GraphQL\Utils

ASTDefinitionBuilder::buildFieldpublicWC 1.0

Method of the class: ASTDefinitionBuilder{}

No Hooks.

Returns

UnnamedFieldDefinitionConfig.

Usage

$ASTDefinitionBuilder = new ASTDefinitionBuilder();
$ASTDefinitionBuilder->buildField( $field, $node ): array;
$field(FieldDefinitionNode) (required)
.
$node(ObjectTypeDefinitionNode|ObjectTypeExtensionNode|InterfaceTypeDefinitionNode|InterfaceTypeExtensionNode) (required)
.

ASTDefinitionBuilder::buildField() code WC 10.9.1

public function buildField(FieldDefinitionNode $field, object $node): array
{
    // Note: While this could make assertions to get the correctly typed
    // value, that would throw immediately while type system validation
    // with validateSchema() will produce more actionable results.
    /** @var OutputType&Type $type */
    $type = $this->buildWrappedType($field->type);

    $config = [
        'type' => $type,
        'description' => $field->description->value ?? null,
        'args' => $this->makeInputValues($field->arguments),
        'deprecationReason' => $this->getDeprecationReason($field),
        'astNode' => $field,
    ];

    if ($this->fieldConfigDecorator !== null) {
        $config = ($this->fieldConfigDecorator)($config, $field, $node);
    }

    return $config;
}