graphql-go icon indicating copy to clipboard operation
graphql-go copied to clipboard

Adding modifying field extraction

Open smotavitaendava opened this issue 4 years ago • 0 comments

Adding a method for extract the fields that are being modifying in a mutation. The idea is to have a list of fields where each field is identified by the path (type.field). e.g.

Having as schema and query:

...
input PersonInput {
    firstName: String!,
    middleName: String,
    lastName: String!
    location: LocationInput
}

input LocationInput {
    name: String!,
    description: String
}
...

mutation addingPerson($name: String!) {
    addPerson(person: {
        firstName: $name,
        middleName: null,
        lastName: "Fixed Last Name",
        location: {
            name: "Fixed Location Name"
        }
    }) { id }
}

The list of fields that are being modified are: person.firstName, person.middleName, person.lastName, person.location.name

Note that person.location.description is not provided, hence, it won't be listed.

smotavitaendava avatar Dec 03 '20 19:12 smotavitaendava