“尝试加载类型时 Lighthouse 失败:<XXX> 确保该类型存在于您的架构定义中”

问题描述

我正在用里面的灯塔进行黄昏测试,例如:

class ExampleTest extends DuskTestCase
{
    use DatabaseMigrations;

    public function testExample()
    {
      //this is a mutation for adding more stuff
      $this->graphQL('mutation ...')

      $this->browse(function (browser $browser) use ($url) {
            $browser->visit($url)
                //asserts...
      });
    }
}

关于我的突变,错误信息是:

"""Lighthouse Failed while trying to load a type: typeFromMySchemaExample \n
\n
Make sure the type is present in your schema deFinition.\n
"""

我已经看到架构通过以下方式有效:

PHP artisan lighthouse:validate-schema

并自行检查模式以查看该类型是否存在:

PHP artisan lighthouse:print-schema

并像 solution#1 一样从 laravel 和 lighthouse 中清除了所有配置/缓存,但没有成功。

在我的作曲家中,我有

  • v6.12.0 中的 laravel/dusk
  • v5.2.0 中的 nuwave/lighthouse
  • v9.5.2 中的 PHPunit/PHPunit

ps:我在 graphql 中注释了该类型,并且错误一直按照我在 schema.graphql 中的导入顺序进行。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)