Skip to content

Commit

Permalink
Merge pull request #91 from petecoop/build-schema
Browse files Browse the repository at this point in the history
Build Schema & Schema Printer
  • Loading branch information
vladar authored Feb 21, 2017
2 parents 0bd7c9d + 664af3d commit ed41a4c
Show file tree
Hide file tree
Showing 9 changed files with 2,599 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Executor/Values.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static function getVariableValues(Schema $schema, $definitionNodes, array
* @return array
* @throws Error
*/
public static function getArgumentValues($def, $node, $variableValues)
public static function getArgumentValues($def, $node, $variableValues = null)
{
$argDefs = $def->args;
$argNodes = $node->arguments;
Expand Down
2 changes: 1 addition & 1 deletion src/Type/Definition/Directive.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static function getInternalDirectives()
new FieldArgument([
'name' => 'if',
'type' => Type::nonNull(Type::boolean()),
'description' => 'Skipped when true'
'description' => 'Skipped when true.'
])
]
]),
Expand Down
8 changes: 4 additions & 4 deletions src/Type/Introspection.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ public static function _schema()
'description' =>
'A GraphQL Schema defines the capabilities of a GraphQL ' .
'server. It exposes all available types and directives on ' .
'the server, as well as the entry points for query and ' .
'mutation operations.',
'the server, as well as the entry points for query, mutation, and ' .
'subscription operations.',
'fields' => [
'types' => [
'description' => 'A list of all types supported by this server.',
Expand Down Expand Up @@ -288,7 +288,7 @@ public static function _directive()
'name' => '__Directive',
'description' => 'A Directive provides a way to describe alternate runtime execution and ' .
'type validation behavior in a GraphQL document.' .
'\n\nIn some cases, you need to provide options to alter GraphQL’s ' .
"\n\nIn some cases, you need to provide options to alter GraphQL's " .
'execution behavior in ways field arguments will not suffice, such as ' .
'conditionally including or skipping a field. Directives provide this by ' .
'describing additional information to the executor.',
Expand Down Expand Up @@ -664,7 +664,7 @@ public static function _typeKind()
if (!isset(self::$map['__TypeKind'])) {
self::$map['__TypeKind'] = new EnumType([
'name' => '__TypeKind',
'description' => 'An enum describing what kind of type a given __Type is.',
'description' => 'An enum describing what kind of type a given `__Type` is.',
'values' => [
'SCALAR' => [
'value' => TypeKind::SCALAR,
Expand Down
8 changes: 8 additions & 0 deletions src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ public static function groupBy($traversable, callable $keyFn)
return $grouped;
}

public static function keyValMap($traversable, callable $keyFn, callable $valFn)
{
return array_reduce($traversable, function ($map, $item) use ($keyFn, $valFn) {
$map[$keyFn($item)] = $valFn($item);
return $map;
}, []);
}

/**
* @param $traversable
* @param callable $predicate
Expand Down
Loading

0 comments on commit ed41a4c

Please sign in to comment.