GraphQL-Ruby Newsletter logo

GraphQL-Ruby Newsletter

Subscribe
Archives
February 18, 2020

GraphQL-Ruby 1.10 is out!

Hi!

GraphQL-Ruby 1.10 is fresh off the press! It's been out for a couple of weeks, and thanks to some early adopters, we've smoothed out a lot of kinks.

The biggest change is that, for class-based schemas using GraphQL::Execution::Interpreter and GraphQL::Analysis::AST, all the various schema definition classes will be used directly at runtime. (Previously, there was a legacy compatibility layer under the hood.) This brings several advantages:
  • Simpler data structures: since a schema and its members are plain Ruby, you can customize them with techniques you already know (class methods, instance variables, etc.)
  • Simpler schema boot: the previous schema definition system had some tricky issues when combined with Rails autoloading. Since the new system is classes all the way down, they should be cleared up.
  • Reduced memory footprint: Since each class doesn't generate a legacy singleton, it doesn't take as much space in memory. Similarly, some costly method redefinition shenanigans from the .define-based API are avoided altogether, reducing the GC pressure of schema boot.
These modules were introduced in GraphQL-Ruby 1.9, and they'll be the only supported behavior in GraphQL-Ruby 2.0, so give the migration a try! If you run into any trouble, please do open an issue.

Other goodies you'll find in 1.10 are:
  • A new connection system, designed specifically for easier customization and handling tricky cases
  • Argument#authorized? and Field#authorized? are now called with three arguments instead of two -- they're also called with the incoming argument (or arguments) value.
  • Execution tracing emits events for "authorized?" and "resolve_type" hooks, improving visibility into runtime performance.
Of course, you'll find the full details in the changelog.

GraphQL-Pro has also had some nice improvements since my last newsletter:
  • Improved stable pagination for ActiveRecord: it's been rewritten using the new connection implementation so that you can opt in (or out) on a case-by-case basis. This also made room for improved handling of NULL values, so that they're properly used in cursors.
  • A Redis backend for persisted operations. It'll come in handy if you're not using ActiveRecord, or if you just want to drop it in and quickly try out the Operation Store.
Again, a detailed list is in the changelog.

GraphQL-Ruby's JavaScript client (I know, that's a thing!) has had plenty of little improvements and a rewrite in TypeScript for v1.7.0.

Finally, a few other projects to share:
  • GraphQL-Cache, a resolver-level cache for GraphQL
  • GraphQL::PersistedQueries, a Ruby server implementation for Apollo's automatic persisted queries
  • ApolloFederation, a Ruby implementation for merging schemas in an Apollo front-end
Oh -- one more thing. It's been a year since I last wrote a newsletter! My New Year's Resolution this year is to write updates quarterly. So, look forward to hearing from me again in a few months 😈

Until then, may all your curly braces be matched and properly indented,

Robert
 
Don't miss what's next. Subscribe to GraphQL-Ruby Newsletter:
Docs GitHub
This email brought to you by Buttondown, the easiest way to start and grow your newsletter.