我想person
用UpdatePerson
变异更新a .我不想指定inputFields
- 中的每个属性- 而是想要传递完整的person对象.
当我这样做时,我得到了 Error: UpdatePersonInput.person field type must be Input Type but got: Person.
有没有办法将完整的对象而不是所有属性传递给变异?
如果没有,你可以添加一个 - 因为较大的应用程序中具有较大对象的字段重复量会变得非常令人沮丧.
同样可能在一个问题getFatQuery
和static fragments
.一遍又一遍地重复所有属性将是一场噩梦.
服务器:
/**
* Create the GraphQL Mutation.
*/
export default mutationWithClientMutationId({
// Mutation name.
name: 'UpdatePerson',
// Fields supplied by the client.
inputFields: {
person: {type: qlPerson} // <========================================
},
// Mutated fields returned from the server.
outputFields: {
person: {
type: qlPerson,
// Parameters are payload from …
Run Code Online (Sandbox Code Playgroud)