Have you considered adding “copy”-directives on types which generate “copyType” mutations?
Could be very useful I think!
type Project
@copy(edit: [name]) {
id ID!
name: String!
owner: User!
images: [Image!]
}
Could generate the mutation:
copyProject(
input: {
filter: {id: {eq: $projectId} }
set: {name: $newName}
})
edit
: would specify all fields that can be changed before copying. All other fields are copied without any changes.
I’m still unsure about how to handle child nodes.
- Copy all fields and only change the parent (here: project)
- Also allow changes to be made on child objects (Becomes very hard with arbitrary depths)
Any opionions?