How to know requested typeDefs on apollo server

for query:
query {
stockData: StockData

type StockData {
price: PriceData
dividend: DividendData
fundamental: FundamentalData

is it possible to know what fields from type “StockData” the client is trying to request.
for example price + dividend or price + fundamental or all the three fields.

You can parse the info object from the resolver’s fourth parameter. It contains the exact structure of the requested query:

export default {
    Query: {
        stockData: (parent, variables, context, info) => {
1 Like