Generators

If you’re using GraphQL with Ruby on Rails, you can use generators to:

graphql:install

You can add GraphQL to a Rails app with graphql:install:

rails generate graphql:install

This will:

After installing you can see your new schema by:

Options

Scaffolding Types

Several generators will add GraphQL types to your project. Run them with -h to see the options:

Scaffolding Functions

You can prepare a GraphQL::Function with

rails g graphql:function #{function_name}

Scaffolding Mutations

You can prepare a Relay mutation with

rails g graphql:mutation #{mutation_name}

Scaffolding Loaders

You can prepare a GraphQL::Batch loader with

rails g graphql:loader