我有这个GraphQL代码:
type Player {
id: ID!
createdAt: Time
updatedAt: Time
teamID: ID!
cityID: ID
type: Int!
score: Int64!
info: String
}
input PlayerInput {
teamID: ID!
cityID: ID
type: Int!
score: Int64!
info: String
}
如您所见,PlayerInput
具有与Player
相同的字段。
是否有避免此字段重复的方法?
拥有这样的东西真是令人惊讶:
type Player {
id: ID!
createdAt: Time
updatedAt: Time
@inherit PlayerInput
}
input PlayerInput {
teamID: ID!
cityID: ID
type: Int!
score: Int64!
info: String
}
我残酷地犯错了吗?