forked from ruudk/graphql-client-code-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.php
More file actions
33 lines (28 loc) · 1.03 KB
/
config.php
File metadata and controls
33 lines (28 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
declare(strict_types=1);
use Http\Discovery\Psr18ClientDiscovery;
use Ruudk\GraphQLCodeGenerator\Config\Config;
use Ruudk\GraphQLCodeGenerator\Examples\GitHubClient;
use Symfony\Component\Dotenv\Dotenv;
use Webmozart\Assert\Assert;
return Config::create(
// https://docs.github.com/public/fpt/schema.docs.graphql
schema: __DIR__ . '/schema.docs.graphql',
projectDir: __DIR__,
outputDir: __DIR__ . '/Generated',
namespace: 'Ruudk\GraphQLCodeGenerator\Examples\Generated',
client: GitHubClient::class,
)
->withQueriesDir(__DIR__)
->withIntrospectionClient(function () {
$dotenv = new Dotenv();
$dotenv->bootEnv(__DIR__ . '/.env.local');
Assert::keyExists($_ENV, 'GITHUB_TOKEN');
$token = $_ENV['GITHUB_TOKEN'];
Assert::stringNotEmpty($token);
return new GitHubClient(Psr18ClientDiscovery::find(), $token);
})
->enableDumpDefinition()
->enableUseNodeNameForEdgeNodes()
->enableUseConnectionNameForConnections()
->enableUseEdgeNameForEdges();