簡體   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