Open Kalanamith opened 1 year ago
I have a graphql mutation defined as follows
updateParts( partId: String! parts: PartRequest! ): UpdatePartsResponse! input PartRequest { name: String! image: Strings! boltTypes: [Bolts]! } input Bolts { code: String! metadata: String! }
and the requirement was to update fields upon selection like
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 ?
Make the fields on PartRequest nullable, this makes them optional. Optionality and nullability are effectively equivalent in GraphQL inputs currently (with the exception of where default values are present).
PartRequest
I have a graphql mutation defined as follows
and the requirement was to update fields upon selection like
Update by selection name only
Update by selection , parts only
How to construct a schema to achieve this ?