src/Generators/SchemaGenerator.php
private function getSchemaForFiles(array $definitionFileDirectories): Schema
    {
        resolve('events')->listen(
            BuildingAST::class,
            function () use ($definitionFileDirectories) {
                $typeDefinitionPaths = $this->definitionsParser->getGraphqlDefinitionFilePaths(
                    $definitionFileDirectories['types']
                );
                $relativeTypeImports = $this->concatSchemaDefinitionFilesFromPath($typeDefinitionPaths);

                // Webonyx GraphQL will not generate a schema if there is not at least one query
                // So just pretend we have one
                $placeholderQuery = 'type Query{placeholder:String}';
                return "$relativeTypeImports\r\n$placeholderQuery";
            }
        );

        $schema = graphql()->prepSchema();

        return $schema;
    }
private function getSchemaForFiles(array $definitionFileDirectories): Schema
    {
        resolve('events')->listen(
            BuildingAST::class,
            function () use ($definitionFileDirectories) {
                $typeDefinitionPaths = $this->definitionsParser->getGraphqlDefinitionFilePaths(
                    $definitionFileDirectories['types']
                );
                $relativeTypeImports = $this->concatSchemaDefinitionFilesFromPath($typeDefinitionPaths);

                // Webonyx GraphQL will not generate a schema if there is not at least one query
                // So just pretend we have one
                $placeholderQuery = 'type Query{placeholder:String}';
                return "$relativeTypeImports\r\n$placeholderQuery";
            }
        );

        $schema = graphql()->prepSchema();

        return $schema;
    }
private function getSchemaForFiles ( array $ definitionFileDirectories ) : Schema { resolve ( 'events' ) -> listen ( BuildingAST :: class , function ( ) use ( $ definitionFileDirectories ) { $ typeDefinitionPaths = $ this -> definitionsParser -> getGraphqlDefinitionFilePaths ( $ definitionFileDirectories [ 'types' ] ) ; $ relativeTypeImports = $ this -> concatSchemaDefinitionFilesFromPath ( $ typeDefinitionPaths ) ; // Webonyx GraphQL will not generate a schema if there is not at least one query // So just pretend we have one $ placeholderQuery = 'type Query{placeholder:String}' ; return "$relativeTypeImports\r\n$placeholderQuery" ; } ) ; $ schema = graphql ( ) -> prepSchema ( ) ; return $ schema ; }
Generates a GraphQL schema for a set of definition files
Definition files can only be Types at this time
In the future this should also support Mutations and Queries

@param array $definitionFileDirectories
@return Schema
@throws \Nuwave\Lighthouse\Exceptions\DirectiveException
@throws \Nuwave\Lighthouse\Exceptions\ParseException
Generates a GraphQL schema for a set of definition files Definition files can only be Types at this time In the future this should also support Mutations and Queries