参数需要xxxxxx类型的位置,但未提供

问题描述

我有这个奇怪的问题。也许我错过了什么

我有两个表格车辆和购买

当我尝试通过以下方式查询车辆

heartbeat_interval_ms

正常返回数据?

    query {
                vehicles{
          id
        }
    }

但是有了这个查询

{
  "data": {
    "vehicles": [
      {
        "id": 29
      }
    ]
  }
}

我收到此错误

    query {
                purchase{
          id
        }
    }

这是我的代码:-

{
  "error": {
    "errors": [
      {
        "message": "Field \"purchase\" argument \"where\" of type \"purchaseWhereUniqueInput!\" is required,but it was not provided.","locations": [
          {
            "line": 2,"column": 3
          }
        ],

解决方法

我意识到nexusjs使用命名约定来确定查询是否应返回列表!

将表名从purchase更改为purchases解决了问题