在我的 GraphQL 模式文件中,我试图添加一个联合类型,如下所示:
type CoOverrides {
coId: String
type: String
}
type SoOverrides {
soId: String
freeInterval: String
}
union CoOrSoOverrides = CoOverrides | SoOverrides
然后我将它分配给我的类型,如下所示:
type Campaign {
id: ID!
title: String
overrides: [CoOrSoOverrides]
}
但是,在启动 graphql 服务器时,我不断收到错误消息:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.coxautodev.graphql.tools.SchemaParser]: Factory method 'schemaParser' threw exception;
nested exception is com.coxautodev.graphql.tools.SchemaClassScannerError:
Object type 'CoOverrides' is a member of a known union, but no class could be found for that type name. Please pass a class for type 'CoOverrides' in the parser's dictionary.
这到底是什么以及如何将此类添加到解析器的字典中?
任何帮助表示赞赏。
谢谢。