英文:
Pass two same parameters in graphql
问题
在GraphiQL中,如何使用ransack传递两个相同的参数?我想要获取状态不等于"A"和"B"的数据。
{
invoice(
q: {id_eq: 7, status_not_eq: "A", status_not_eq: "B"}
) {
status
paymentStatus
}
}
错误信息
"There can be only one input field named "status_not_eq"."
英文:
In GraphiQL, how to pass two same parameter using ransack? I want to get data where status not equal to "A" and "B"
{
invoice(
q: {id_eq: 7, status_not_eq: "A",status_not_eq:"B"}
) {
status
paymentStatus
}
}
Error
"There can be only one input field named \"status_not_eq\""
答案1
得分: 0
根据错误信息以及考虑到你自己在使用只有一个status_not_eq查询服务时的经验,以及无法通过实际的GraphQL合同确认,我得出结论,此查询仅允许每个请求使用一个status_not_eq。
如果你想要使用不同的条件进行查询(在这种情况下,允许一个status_not_eq数组),合同需要更改,实现也需要编写(如果尚未存在)。
今天,在这个查询的架构中的某个地方,它说:
...
tenancy_id_eq:Int, status_not_eq:String
...
你需要向后端团队提出的问题是:
...
tenancy_id_eq:Int, status_not_eq:[String]
...
英文:
As the error states, and considering what you have experienced yourself when querying the service with only one status_not_eq; and not being able to confirm it with the actual GraphQL contract, I conclude that this query admits only one status_not_eq per request.
If you want to query with a different criteria (in this case, admitting an array of status_not_eq), the contract would need to change and the implementation would have to be coded (in case it doesn't exist).
Today, somewhere in the schema for this query it says:
...
tenancy_id_eq:Int, status_not_eq:String
...
What you need to ask the backend team:
...
tenancy_id_eq:Int, status_not_eq:[String]
...
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论