gpt4 book ai didi

graphql - 变量和参数的类型不匹配(整数/整数)

转载 作者:行者123 更新时间:2023-12-03 08:09:47 28 4
gpt4 key购买 nike

给定以下GraphQL请求和变量:
请求:

query accounts($filter:AccountFilter, $first_:String, $skip_:Int) {
accounts(filter: $filter, first: $first_, skip: $skip_) {
id
}
}
变量:
{
"filter": {},
"first_": "3",
"skip_": 0
}
注意:我在 first_skip_变量名称中添加了下划线,以帮助将它们与 firstskip参数区分开。
我收到以下错误: "Type mismatch on variable $first_ and argument first (String / Int)" "Type mismatch on variable $skip_ and argument skip (Int / Int)"我故意创建的第一个错误是进行完整性检查。变量中的值应为 "first": 3,而不是 "first": "3",。我不明白为什么要得到第二个错误。 IntInt类型如何不匹配?当我正确传递 first并将 (Int / Int)更改为 3时, String变量/参数错误会再次显示相同的错误 Int
我究竟做错了什么?
后端规格:
Ruby on Rails
参数规范:
"""
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,我仍然遇到这个问题。
您可以在此处查看问题:
https://github.com/rmosolgo/graphql-ruby/issues/2784
该帖子中包含的对我有用的修复程序在这里:

def self.type_from_ast(*args)
type = super
type == GraphQL::Types::Int ? type.to_graphql : type
end

关于graphql - 变量和参数的类型不匹配(整数/整数),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65500327/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com