首页 > 解决方案 > 需要澄清 GraphQL 全局对象识别规范中描述的根查询类型上的“节点”字段

问题描述

我正在检查 GraphQL 全局对象识别规范并发现以下内容:

To provide options for GraphQL clients to elegantly handle for caching and 
data refetching GraphQL servers need to expose object identifiers in a standardized way. 
In the query, the schema should provide a standard mechanism for asking for an object by ID.

后来他们提供了要求:

Refetching the object is done with the `node` field on the root query object.

如果我理解正确,他们希望有这样的架构:

type Query {
   node(id: ID!)
}

我的问题是:我应该如何理解他们指的是什么对象?我有关系数据库和大量表。我应该扫描它们中的每一个以找到具有该 ID 的对象吗?

或者 id 应该已经包含有关对象类型的信息?

提前致谢。

标签: graphqlgraphql-java

解决方案


推荐阅读