【发布时间】:2020-05-06 14:03:20
【问题描述】:
我需要一些帮助,我无法完成这项工作。
我首先使用带有 GraphQL 的 NestJs - 架构。
我有以下架构:
type Small {
id: Int
name: String
color: String
}
type Big {
id: Int
name: String
size: Int
}
type Huge {
id: Int
name: String
engine: Int
}
type Cars {
id: Int
name: String
type: Types
}
union Types = Small | Big | Huge
type Query {
car(id: ID!): Cars
}
您能告诉我如何为 type 字段(即 Types 类型)创建解析器吗?
【问题讨论】: