我要弃用一个变体:
updateObject(
id: String!
object: ObjectInput!
): Object!
Run Code Online (Sandbox Code Playgroud)
我们想将其更改为:
updateObject(
object: UpdateObjectInput!
): Object!
Run Code Online (Sandbox Code Playgroud)
其中,ObjectInput和UpdateObjectInput是:
input ObjectInput {
product: String!
isPercentage: Boolean
amount: Float!
visibility: ObjectVisibility
isDiscontinued: Boolean
expiresAt: String
}
Run Code Online (Sandbox Code Playgroud)
和
input UpdateObjectInput {
id: String!
visibility: ObjectVisibility
isDiscontinued: Boolean
expiresAt: String
}
Run Code Online (Sandbox Code Playgroud)
基本上,ObjectInput非常适合创建Object,但不适用于更新它。
我们尝试使突变超载或将突变标记为已弃用,但均无效。
我们提出的唯一其他解决方案是将新的updateObject突变重命名为其他名称,例如“ newUpdateObject”,或者使id和object字段弃用且为可选,然后添加字段“ updateObject”或在新的UpdateObjectInput中。但是,这些都不是最优的。
还有另一种方法可以完成迁移吗?