繁体   English   中英

为什么每个 GraphQL 模式都有一个根查询和变异类型?

[英]Why does every GraphQL schema have a root query and mutation type?

为什么每个 GraphQL 模式都需要根querymutation类型? 这似乎是不必要的样板。 模式是否需要以不同的方式编写? 这一点样板不应该很明显吗?

schema {
  query:Query
  mutation:Mutation
}

我也在谷歌上搜索这个,最终手动搜索了有此评论的 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.
 */

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM