Skip to content

Commit

Permalink
Fix conversion of client directives after the schema was cached (#1019)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeboot authored and spawnia committed Oct 17, 2019
1 parent 9dba7fd commit b01fde2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/nuwave/lighthouse/compare/v4.5.1...master)
## [Unreleased](https://github.com/nuwave/lighthouse/compare/v4.5.2...master)

## [4.5.2](https://github.com/nuwave/lighthouse/compare/v4.5.1...v4.5.2)

### Fixed

- Fix conversion of client directives after the schema was cached https://github.com/nuwave/lighthouse/pull/1019

## [4.5.1](https://github.com/nuwave/lighthouse/compare/v4.5.0...v4.5.1)

Expand Down
14 changes: 7 additions & 7 deletions src/Schema/Factories/ClientDirectiveFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Nuwave\Lighthouse\Schema\Factories;

use GraphQL\Language\AST\NameNode;
use GraphQL\Type\Definition\Directive;
use GraphQL\Type\Definition\FieldArgument;
use Nuwave\Lighthouse\Schema\AST\ASTHelper;
Expand Down Expand Up @@ -54,15 +53,16 @@ public function handle(DirectiveDefinitionNode $directive): Directive
$arguments [] = new FieldArgument($fieldArgumentConfig);
}

$locations = [];
// Might be a NodeList, so we can not use array_map()
foreach ($directive->locations as $location) {
$locations[] = $location->value;
}

return new Directive([
'name' => $directive->name->value,
'description' => data_get($directive->description, 'value'),
'locations' => array_map(
function (NameNode $location): string {
return $location->value;
},
$directive->locations
),
'locations' => $locations,
'args' => $arguments,
'astNode' => $directive,
]);
Expand Down

0 comments on commit b01fde2

Please sign in to comment.