简体   繁体   中英

What's the best term for a top-level field on the Query type?

type Query {
  foo: String
}

What is foo ? The spec doesn't give an official term. Some options include "query", "method", "endpoint" or "resource" from REST, and "action".

I call it a "query root field" and I likewise call Query the "query root type".

I don't recommend calling it a method, endpoint, resource, or action, because those are those conflate it with concepts from REST that are actually pretty different. Your whole GraphQL endpoint is the resource, effectively.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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