【发布时间】:2021-12-09 08:02:42
【问题描述】:
您好,我是 GraphQL 的新用户,正在尝试创建我将使用的架构。 我看到here 当您有多对多关系时,建议使用以下结构。
type UserCommunity
@auth
@model(queries: null)
@key(name: "byUser", fields: ["userID", "communityID"]
@key(name: "byCommunity", fields: ["communityID","userID"]{
id: ID!
userID: ID!
communityID: ID!
user: User! @connection(fields: ["userID"])
community: Community! @connection(fields: ["communityID"])
}
但是,当我使用 AWS Amplify 进行部署时,我收到以下错误消息:
GraphQLError: Syntax Error: Expected Name, found @
它也告诉我它在这条线上失败了:
@key(name: "byCommunity", fields: ["communityID","userID"]{
我已尝试查找所有文档并查看了其他堆栈溢出问题,但尚未解决语法问题。
任何帮助将不胜感激!
【问题讨论】:
标签: graphql schema aws-amplify