aws amplify – GraphQL: Remove field from query string

I have a graphQL server consumed by many clients and have a process that generates operations from introspection; problem is that the schema has a handful of nested queries that take arguments that I may or may not want to invoke.

given this generated operation

query Query($input: String!) {
  things(input: $input) {
     item1
     item2
     nestedQuery(nestedInput: $nestedInput) {
        nestedItem1
     }
  }   
}

is there a tool (other than string parsing, that’s a given) to strip unwanted fields from here so that the query is transformed into

query Query($input: String!) {
  things(input: $input) {
     item1
     item2
  }   
}

Looking at the introspection JSON I can identify this item by the presence of args on the field things that is past the first depth – but I don’t want to necessarily lose information on generation – I’d like those nested queries to be visible/documented.

Read more here: Source link