Julia Code Generation With GraphQL

Mark Halonen
April 2nd, 2021
featured
julia-graphql

Laurium Labs is pleased to publish open source software that assists Julia clients that are consuming GraphQL apis.

GraphQL is a "query language for your API" that is aimed to be a replacement for REST.

A GraphQL client requests exactly which data to get back, unlike REST, where a "hope-and-pray" paradigm is employed. The beauty of GraphQL queries is that the resulting JSON of a request comes back in a predictable format. This allows for generating native types (TypeScript, Julia, Swift, Java etc.) that automatically are populated from the response JSON.

I built Waldo using this technique extensively, with >100 GraphQL queries and their associated auto-genned types. It works fantastically well and almost feels like cheating.

Without further ado, let's get into the code!

I recommend starting at the GithubGraphQLExample to understand how the tools work together. It's not a minor endeavor, but if you're going to be writing many GraphQL queries in Julia, it's worth it.

As consumers of much open source software, Laurium Labs is happy to contribute back to the Julia and GraphQL communities.

If you are endeavoring on a project using GraphQL and Julia, we'd love to hear about it!

Never miss a blog post

Join our email list to stay up to date on new blog posts