GraphQL with Rails Part 2 •WIP•

GraphQL Mutations, Arguments, and Aliases are core concepts for anyone new to learning GraphQL. GraphQL Mutations are used to make a change to a server, GraphQL Arguments are available at any level of the object tree and even as part of any object, and GraphQL Aliases let you query for the same field with different arguments

In Part 1 of GraphQL with Rails, I covered the most basic User has many Posts setup for making a REST-like interface for your GraphQL-Rails installation.

In part 1, we covered the installation, Type definitions, and Queries. This post picks up where that post leaves off and covers Mutations, Arguments, and Aliases

But one interesting features of GraphQL is that it allows us— using Type definitions — to think outside the box of our ORM-backed (that is, ActiveRecord tables & model objects) Rails app and wrap any of our business concepts around the graph.

In these examples, I will mix “ephemeral” (that is, no database records) mental models with real objects (database records) so that we can demonstrate that GraphQL can serve as the powerful conduit to your frontend, Swift or React Native app.

6. Mutations

7. Arguments

8. Aliases