Graphql 变量和参数的类型不匹配(Int/Int)

Graphql 变量和参数的类型不匹配(Int/Int),graphql,syntax-error,type-mismatch,Graphql,Syntax Error,Type Mismatch,给定以下GraphQL请求和变量: 请求: query accounts($filter:AccountFilter, $first_:String, $skip_:Int) { accounts(filter: $filter, first: $first_, skip: $skip_) { id } } """ Interface for the Account model """ type Account {

给定以下GraphQL请求和变量:

请求:

query accounts($filter:AccountFilter, $first_:String, $skip_:Int) {
  accounts(filter: $filter, first: $first_, skip: $skip_) {
    id
  }
}
"""
Interface for the Account model
"""
type Account {
  friendlyId: String!
  id: ID!
  locations: [Location!]!
  name: String!
  participants: [User!]!
  primaryLocation: Location!
  primarySiteContact: User!
  siteContacts: [User!]!
}

input AccountFilter {
  OR: [AccountFilter!]
}

type Query {
  """
  Details for an Account
  """
  accountDetails(id: ID): Account

  """
  A list of Accounts
  """
  accounts(filter: AccountFilter, first: Int, skip: Int): [Account!]
}
变量:

query accounts($filter:AccountFilter, $first_:String, $skip_:Int) {
  accounts(filter: $filter, first: $first_, skip: $skip_) {
    id
  }
}
"""
Interface for the Account model
"""
type Account {
  friendlyId: String!
  id: ID!
  locations: [Location!]!
  name: String!
  participants: [User!]!
  primaryLocation: Location!
  primarySiteContact: User!
  siteContacts: [User!]!
}

input AccountFilter {
  OR: [AccountFilter!]
}

type Query {
  """
  Details for an Account
  """
  accountDetails(id: ID): Account

  """
  A list of Accounts
  """
  accounts(filter: AccountFilter, first: Int, skip: Int): [Account!]
}
{
“筛选器”:{},
“第一条”:“3”,
“跳过”:0
}
注意:我在
first
skip
变量名中添加了下划线,以帮助将它们与参数
first
skip
区分开来

我得到以下错误:

“变量$first和参数first(String/Int)的类型不匹配”

“变量$skip_uuu和参数skip(Int/Int)的类型不匹配”

我故意创建的第一个错误是作为健全性检查。变量中的值应该是
“first”:3,
,而不是
“first”:“3”,
。第二个错误我不明白为什么我会得到它。
Int
Int
类型如何不匹配?当我正确地传递
3
并将
String
更改为
Int
时,
第一个
变量/参数错误会再次出现相同的错误
(Int/Int)

我做错了什么

后端规格: RubyonRails

参数规格:

query accounts($filter:AccountFilter, $first_:String, $skip_:Int) {
  accounts(filter: $filter, first: $first_, skip: $skip_) {
    id
  }
}
"""
Interface for the Account model
"""
type Account {
  friendlyId: String!
  id: ID!
  locations: [Location!]!
  name: String!
  participants: [User!]!
  primaryLocation: Location!
  primarySiteContact: User!
  siteContacts: [User!]!
}

input AccountFilter {
  OR: [AccountFilter!]
}

type Query {
  """
  Details for an Account
  """
  accountDetails(id: ID): Account

  """
  A list of Accounts
  """
  accounts(filter: AccountFilter, first: Int, skip: Int): [Account!]
}
这是Ruby的graphql的一个已知问题。该问题似乎有可用的PR和修复程序,但即使在更新我的
graphql
gem之后,我仍然存在此问题

您可以在此处查看此问题:

该帖子中包含的对我有效的修复方法如下:

def self.type_from_ast(*args)
类型=超级
type==GraphQL::Types::Int?type.to_图形ql:type
结束

在哪里?什么环境/语言。。。是否是此查询的spec/arg类型?您可以共享您的模式吗?@xadm抱歉,我没有发现后端会出现差异,我想我已经推断
first
skip
应该是
Int
s。@JosephHall,我添加了相关的模式部分(请参见第二次编辑)。这是固有的,所以我只包括我认为有必要知道的内容。如果你还需要什么,请告诉我。谢谢你的帮助!这可能是特定于语言/实现(解析器)的问题,因为gql类型/参数看起来正常