在GraphQL中使用没有任何参数的工具

时间:2018-06-12 06:21:02

标签: graphql apollo graphql-js apollo-server

如果我想在没有任何参数的情况下使用interface/implements,我该怎么做?

我目前的代码如下:

interface User {
   GUID: String
   name: String
   age: Int
}

type FacebookUser implements User

type GoogleUser implements User

我这样做的原因是处理FacebookUsers的年龄增长和GoogleUsers在Resolvers功能方面的年龄变化。 如果他们没有要求年龄,我根本不想得到它们。

如果我添加它,它可以工作:

interface User {
   GUID: String
   name: String
   age: Int
}

type FacebookUser implements User {
   bogus: String
}

type GoogleUser implements User {
   bogus: String
}

但除了底层系统之外,没有什么可以区分用户,所以我不想为它们添加特定的字段。

我正在使用Apollo GraphQL Tools 3.0.2

0 个答案:

没有答案
相关问题