Thinking about a solution, to stay within the "graphql way", I was thinking of doing this:
1. Send introspection queries[1] to get the schema.
2. Iterate over the results, building a query object with all of the non deprecated fields.
3. Store the results in a db or cache for later queries.
4. Send the request as normal with the full query.
https://graphql.org/learn/introspection/
[1] Example introspection query:
query {
__schema {
types {
name
kind
}
}
}
query {
__type(name: "YourTypeName") {
name
kind
fields {
name
type {
name
kind
ofType {
name
kind
}
}
description
isDeprecated
deprecationReason
}
}
}