Understanding the GraphQL AST.

So what is an Abstract Syntax Tree?

  • parent — Otherwise known as the root — since resolvers can delegate to other resolvers this argument contains the result of the previous call
  • args — parameters requested by the user for the query
  • context — ‘global’ variable passed through the resolver chain. Useful for communicating between different layers
  • info — This is our crown jewel. This is our AST
  • fieldName: the name of the current resolver
  • fieldNodes: an array of fields left in the current selectionSet (group of fields on current object we are traversing in the tree)
  • path: Keeps track of all the parent fields that led to the current branch
  • operation: The entire query info. (this is a global field that will be the same for any resolver. Other global fields include schema, fragments, rootValueand variableValues.

So why is all this important?

  • Schema stitching
  • Custom directives
  • Enriched queries
  • Layered Abstraction
  • More backend magic!

Custom Directives

Caching

Conclusion

--

--

--

Tech Lead at Payble. Sydney, Australia. We’re hiring https://payble.com.au

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Code with C

Dynamic Programming (Part 1)

What is the Linked Open Data Cloud, and why is it important?

Data Preprocessing in Python using Scikit-Learn

The Final Countdown

Building the Resilient Service : A three pronged Approach

Flash Stock Rom on Vivo E5

Download Official Stock Rom For Vivo

Effective Ways of Managing Your Terraform State

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adam Hannigan

Adam Hannigan

Tech Lead at Payble. Sydney, Australia. We’re hiring https://payble.com.au

More from Medium

Code Collaboration: Persisted State Sharing

Running a Migration Making 800k API Calls Without Crashing Prod

Divide and Conquer your components

i18next: Synchronised dictionaries lifecycle