diff --git a/lib/internal/Magento/Framework/GraphQl/Config.php b/lib/internal/Magento/Framework/GraphQl/Config.php index b7f198656d81d..3873044007b4e 100644 --- a/lib/internal/Magento/Framework/GraphQl/Config.php +++ b/lib/internal/Magento/Framework/GraphQl/Config.php @@ -83,11 +83,11 @@ public function getConfigElement(string $configElementName) : ConfigElementInter /** * Return all type names declared in a GraphQL schema's configuration and their type. * + * Format is ['name' => 'example value', 'type' = 'example value'] + * * @return array $types - * name string - * type string */ - public function getDeclaredTypeNames() : array + public function getDeclaredTypes() : array { $types = []; foreach ($this->configData->get(null) as $item) { diff --git a/lib/internal/Magento/Framework/GraphQl/Config/Element/InputFactory.php b/lib/internal/Magento/Framework/GraphQl/Config/Element/InputFactory.php index 677354f67e230..3d6e6a56781e0 100644 --- a/lib/internal/Magento/Framework/GraphQl/Config/Element/InputFactory.php +++ b/lib/internal/Magento/Framework/GraphQl/Config/Element/InputFactory.php @@ -73,7 +73,7 @@ public function createFromConfigData(array $data): ConfigElementInterface } /** - * Create type object based off array of configured GraphQL InputType data. + * Create input type object based off array of configured GraphQL InputType data. * * Type data must contain name and the type's fields. Optional data includes description. * diff --git a/lib/internal/Magento/Framework/GraphQl/Query/Fields.php b/lib/internal/Magento/Framework/GraphQl/Query/Fields.php index d0c88cb0f898e..32f4e264f5eda 100644 --- a/lib/internal/Magento/Framework/GraphQl/Query/Fields.php +++ b/lib/internal/Magento/Framework/GraphQl/Query/Fields.php @@ -44,7 +44,7 @@ public function setQuery($query, array $variables = null) ] ); if (isset($variables)) { - $queryFields = array_merge($queryFields, $this->getVariables($variables)); + $queryFields = array_merge($queryFields, $this->extracttVariables($variables)); } } catch (\Exception $e) { // If a syntax error is encountered do not collect fields @@ -75,12 +75,12 @@ public function getFieldsUsedInQuery() * * @return string[] */ - private function getVariables(array $variables): array + private function extracttVariables(array $variables): array { $fields = []; foreach ($variables as $key => $value){ if (is_array($value)){ - $fields = array_merge($fields, $this->getVariables($value)); + $fields = array_merge($fields, $this->extracttVariables($value)); } $fields[$key] = $key; } diff --git a/lib/internal/Magento/Framework/GraphQl/Schema/Type/TypeRegistry.php b/lib/internal/Magento/Framework/GraphQl/Schema/Type/TypeRegistry.php index 6b1e20f996def..634975426cf80 100644 --- a/lib/internal/Magento/Framework/GraphQl/Schema/Type/TypeRegistry.php +++ b/lib/internal/Magento/Framework/GraphQl/Schema/Type/TypeRegistry.php @@ -71,7 +71,10 @@ public function get(string $typeName): TypeInterface $configElementClass = get_class($configElement); if (!isset($this->configToTypeMap[$configElementClass])) { throw new GraphQlInputException( - new Phrase("Type for '{$configElementClass}' has not declared.") + new Phrase( + "No mapping to Webonyx type is declared for '%1' config element type.", + [$configElementClass] + ) ); }