说GET变量我有以下几点:阿波罗GraphQL服务器:在解析器,从几个层次在我的解析器更高
Query: {
author: (root, args) => API.getAuthor(args.authorId),
},
Author: {
book: (author, args) => API.getBook(author.id, args.bookId),
},
Book: {
// Here, I can't get the author ID
chapter: (book, args) => API.getChapter(authorId???, book.id, args.chapterId),
}
我的问题是从上面的例子很清楚,我怎么能访问变量从几个层次更高? 我希望能够提出请求如下所示:
author(authorId: 1) {
id
book(bookId: 31) {
id
chapter(chapterId: 3) {
content
}
}
}
而我的连接器,以获得特定章节还需要作者的ID。
你不能,而这intented – whitep4nther
不书有 'AUTHOR_ID' 字段? – whitep4nther
@ whitep4nther哦,该死的太糟了,为什么?不,在我的现实生活中,书没有author_id字段。 – Bertrand