I have a graphql mutation defined as follows
type Mutation {
updateParts(
partId: String!
parts: PartRequest!
): UpdatePartsResponse!
}
input PartRequest {
name: String!
image: Strings!
boltTypes: [Bolts]!
}
input Bolts {
code: String!
metadata: String!
}
Mhy requirement was to update fields upon selection as following.
- update all
mutation {
updateParts(
partId: "0x1223"
parts: {
name: "some"
image: "dark.png"
boltTypes: [
{ code: "A", metadata: "B" }
]
}
)
}
}
- Update by selection: name only
mutation {
updateParts(
partId: "0x1223"
parts: {
name: "some"
}
)
}
}
- Update by selection: parts only
mutation {
updateParts(
partId: "0x1223"
parts: {
boltTypes: [
{ code: "A", metadata: "B" }
]
}
)
}
}
How to construct a schema to achieve this ?