背景
我们正在开展一个相当大的Apollo项目。我们 API 的一个非常简化版本如下:
type Operation {
foo: String
activity: Activity
}
type Activity {
bar: String
# Lots of fields here ...
}
我们意识到将Operation
和Activity
分开没有任何好处,反而增加了复杂性。因此我们想要将它们合并。但是在代码库中有很多查询都假定了这种结构。为了使转换逐步进行,我们添加了@deprecated
指令:
type Operation {
foo: String
bar: String
activity: Activity @deprecated
}
type Activity {
bar: String @deprecated(reason: "Use Operation.bar instead")
# Lots of fields here ...
}
实际问题
有没有一种方法可以在今后突出显示这些弃用项?最好是在(测试环境中)运行使用已弃用字段的查询时,在浏览器控制台中打印警告信息。