为什么每个GraphQL架构都需要根query
和mutation
类型?这似乎是不必要的样板。模式是否需要以不同方式编写?这个样板不应该是显而易见的吗?
schema {
query:Query
mutation:Mutation
}
答案 0 :(得分:1)
我也是谷歌搜索,最后手动搜索有this comment的graphql-js源:
/**
* GraphQL schema define root types for each type of operation. These types are
* the same as any other type and can be named in any manner, however there is
* a common naming convention:
*
* schema {
* query: Query
* mutation: Mutation
* }
*
* When using this naming convention, the schema description can be omitted.
*/