[英]Why does every GraphQL schema have a root query and mutation type?
為什么每個 GraphQL 模式都需要根query
和mutation
類型? 這似乎是不必要的樣板。 模式是否需要以不同的方式編寫? 這一點樣板不應該很明顯嗎?
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.