Skip to content

Commit ed41a4c

Browse files
authored
Merge pull request #91 from petecoop/build-schema
Build Schema & Schema Printer
2 parents 0bd7c9d + 664af3d commit ed41a4c

File tree

9 files changed

+2599
-8
lines changed

9 files changed

+2599
-8
lines changed

src/Executor/Values.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static function getVariableValues(Schema $schema, $definitionNodes, array
9494
* @return array
9595
* @throws Error
9696
*/
97-
public static function getArgumentValues($def, $node, $variableValues)
97+
public static function getArgumentValues($def, $node, $variableValues = null)
9898
{
9999
$argDefs = $def->args;
100100
$argNodes = $node->arguments;

src/Type/Definition/Directive.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static function getInternalDirectives()
107107
new FieldArgument([
108108
'name' => 'if',
109109
'type' => Type::nonNull(Type::boolean()),
110-
'description' => 'Skipped when true'
110+
'description' => 'Skipped when true.'
111111
])
112112
]
113113
]),

src/Type/Introspection.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ public static function _schema()
235235
'description' =>
236236
'A GraphQL Schema defines the capabilities of a GraphQL ' .
237237
'server. It exposes all available types and directives on ' .
238-
'the server, as well as the entry points for query and ' .
239-
'mutation operations.',
238+
'the server, as well as the entry points for query, mutation, and ' .
239+
'subscription operations.',
240240
'fields' => [
241241
'types' => [
242242
'description' => 'A list of all types supported by this server.',
@@ -288,7 +288,7 @@ public static function _directive()
288288
'name' => '__Directive',
289289
'description' => 'A Directive provides a way to describe alternate runtime execution and ' .
290290
'type validation behavior in a GraphQL document.' .
291-
'\n\nIn some cases, you need to provide options to alter GraphQL’s ' .
291+
"\n\nIn some cases, you need to provide options to alter GraphQL's " .
292292
'execution behavior in ways field arguments will not suffice, such as ' .
293293
'conditionally including or skipping a field. Directives provide this by ' .
294294
'describing additional information to the executor.',
@@ -664,7 +664,7 @@ public static function _typeKind()
664664
if (!isset(self::$map['__TypeKind'])) {
665665
self::$map['__TypeKind'] = new EnumType([
666666
'name' => '__TypeKind',
667-
'description' => 'An enum describing what kind of type a given __Type is.',
667+
'description' => 'An enum describing what kind of type a given `__Type` is.',
668668
'values' => [
669669
'SCALAR' => [
670670
'value' => TypeKind::SCALAR,

src/Utils.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ public static function groupBy($traversable, callable $keyFn)
180180
return $grouped;
181181
}
182182

183+
public static function keyValMap($traversable, callable $keyFn, callable $valFn)
184+
{
185+
return array_reduce($traversable, function ($map, $item) use ($keyFn, $valFn) {
186+
$map[$keyFn($item)] = $valFn($item);
187+
return $map;
188+
}, []);
189+
}
190+
183191
/**
184192
* @param $traversable
185193
* @param callable $predicate

0 commit comments

Comments
 (0)