public function schema()
    {
        $schema = [
            // usually inferred from 'query', but required for polymorphism on InterfaceType-based query results
            self::TYPES_ROOT => $this->types,
        ];

        if (!empty($this->queries)) {
            $schema[self::QUERY_ROOT] = new ObjectType([
                'name' => 'Query',
                'fields' => function () {
                    return array_map(function ($query) {
                        return is_callable($query) ? $query() : $query;
                    }, $this->queries);
                },
            ]);
        } else {
            $schema[self::QUERY_ROOT] = new ObjectType([
                'name' => 'Query',
            ]);
        }

        if (!empty($this->mutations)) {
            $schema[self::MUTATION_ROOT] = new ObjectType([
                'name' => 'Mutation',
                'fields' => function () {
                    return array_map(function ($mutation) {
                        return is_callable($mutation) ? $mutation() : $mutation;
                    }, $this->mutations);
                },
            ]);
        }

        return new Schema($schema);
    }
public function schema()
    {
        $schema = [
            // usually inferred from 'query', but required for polymorphism on InterfaceType-based query results
            self::TYPES_ROOT => $this->types,
        ];

        if (!empty($this->queries)) {
            $schema[self::QUERY_ROOT] = new ObjectType([
                'name' => 'Query',
                'fields' => function () {
                    return array_map(function ($query) {
                        return is_callable($query) ? $query() : $query;
                    }, $this->queries);
                },
            ]);
        } else {
            $schema[self::QUERY_ROOT] = new ObjectType([
                'name' => 'Query',
            ]);
        }

        if (!empty($this->mutations)) {
            $schema[self::MUTATION_ROOT] = new ObjectType([
                'name' => 'Mutation',
                'fields' => function () {
                    return array_map(function ($mutation) {
                        return is_callable($mutation) ? $mutation() : $mutation;
                    }, $this->mutations);
                },
            ]);
        }

        return new Schema($schema);
    }
public function schema ( ) { $ schema = [ // usually inferred from 'query', but required for polymorphism on InterfaceType-based query results self :: TYPES_ROOT => $ this -> types , ] ; if ( ! empty ( $ this -> queries ) ) { $ schema [ self :: QUERY_ROOT ] = new ObjectType ( [ 'name' => 'Query' , 'fields' => function ( ) { return array_map ( function ( $ query ) { return is_callable ( $ query ) ? $ query ( ) : $ query ; } , $ this -> queries ) ; } , ] ) ; } else { $ schema [ self :: QUERY_ROOT ] = new ObjectType ( [ 'name' => 'Query' , ] ) ; } if ( ! empty ( $ this -> mutations ) ) { $ schema [ self :: MUTATION_ROOT ] = new ObjectType ( [ 'name' => 'Mutation' , 'fields' => function ( ) { return array_map ( function ( $ mutation ) { return is_callable ( $ mutation ) ? $ mutation ( ) : $ mutation ; } , $ this -> mutations ) ; } , ] ) ; } return new Schema ( $ schema ) ; }
Build the main Schema instance that represents the final schema for this endpoint

@return Schema
Build the main Schema instance that represents the final schema for this endpoint