graphql - GraphQLError:语法错误:预期:,找到{
问题描述
这是我的 graphql 查询/突变。
我收到错误:GraphQLError: Syntax Error: Expected :, found {
我不知道其中哪一个是错的。
import gql from 'graphql-tag';
export const CategoriesQuery = gql`
query categoriesQuery(
$id: ID!,
$country: String!,
$name: String!
) {
sections(
id: $id,
country: $country,
name: $description
) {
id,
createdBy,
createdDate,
lastUpdate,
name
}
}
`;
export const ItemsQuery = gql`
query itemsQuery(
$id: ID!,
$category: String!,
$url: String!,
$alias: String!,
$name: String!
) {
items(
input {
id: $id,
category: $category,
url: $url,
alias: $alias,
name: $name
}
) {
id,
createdBy,
createdDate,
lastUpdate,
name,
category,
url,
alias,
description
}
}
`;
export const AddCategoryMutation = gql`
mutation ($category: CategoryInput!) {
addCategory(category: $category) {
id
}
}
`;
export const AddItemMutation = gql`
mutation ($item: ItemInput!) {
addItem(item: $item){
id
}
}
`;
解决方案
这是第二个查询。你需要改变这个
items(
input {
id: $id,
category: $category,
url: $url,
alias: $alias,
name: $name
}
)
对此:
items(
input: {
id: $id,
category: $category,
url: $url,
alias: $alias,
name: $name
}
)
后面加一个冒号input
推荐阅读
- python - 使用 python 读取 xml 元素
- php - Joomla & PHP 7:致命错误:参数 1 传递给 JErrorPage::render()
- android - Firebase 多级子查询 Android
- python - 终端中的python3子进程pip“ImportError:无法导入名称main”
- python - Python3中多处理进程的实例变量未在终止时写入
- python - Matplotlib 刺/轴切割
- powerbi - Maxtrix - 如何将列移动到行
- swift - 如何在使用 swift 播放音乐时获取 iPhone 的当前音量并更改它?
- c - 多个目录中的`dirent.h`
- php - php zip添加未选择的文件